An ionic compound is composed of ions, which are atoms or molecules that have lost or gained electrons, resulting in a net electric charge. In SO4, the sulfur atom has lost six electrons, resulting in a +6 charge, while each oxygen atom has gained two electrons, resulting in a -2 charge. The electrostatic attraction between the positively charged sulfur ion and the negatively charged oxygen ions holds the compound together.