An ionic compound is composed of ions, which are atoms or molecules that have lost or gained electrons. In PtO2, Pt is a metal and O is a nonmetal. Metals tend to lose electrons, while nonmetals tend to gain electrons. So in PtO2, Pt loses two electrons to become Pt2+, while O gains two electrons to become O2-. The resulting compound is ionic because it is composed of positively charged ions (Pt2+) and negatively charged ions (O2-).