Sodium oxide (Na2O) is an ionic compound. Its constituent atoms are, respectively, a metal and a non-metal.
Sodium (Na), as a metal, will attempt to lose electrons to reach an octet state. Oxygen (O2), as a non-metal, will attempt to gain electrons to reach an octet state.