A cation has more protons then electrons which gives a positive charge, for it to form one or more electrons has to be lost for example is Ag loses 2 electrons it would become Ag^2+
An anion has more electrons then protons, giving it a negative charge, for this to form one or more electrons has to be gained for example if Cl gains three electron it would become Cl^3-
Cations and anions are both ions and since they have an opposite electrical charge they would be attracted to each other