Derive both Apartment and Occupant from the common base class and either use dynamic_cast or implement virtual methods isOccupant() and isApartment() in the base class and reimplement them in the subclasses properly so that you can determine the type of the object by calling one of these.
Bookmarks