So when no noun was really used, you think of what it is your talking about and use the theoretical nouns gender for он, она, оно, его, её...
Exactly.
The gender of the pronoun used corresponds to the one of the noun implied.