An ionic compound is formed from a metallic atom and non-metallic atom.
Ionic compound results from an ionic bond between a non-metal atom and a metal atom.
Ionic bond occurs when a metallic atom loses an electron(s) to form a cation and a non-metallic atom gains electron(s) to form an anion.
The electrostatic attraction between the negatively charged ion and the positively charged ion creates an ionic bond, thus, resulting in the formation of an ionic compound.
In this case, calcium oxide is an example of an ionic compound.
Calcium atom loses two electrons to form positively charged calcium ion while the oxygen atom gains two electrons to form a negatively charged oxygen ion.
Calcium ion and oxygen ion form an ionic bond thus resulting in the formation of an ionic compound.