[comp.lang.c++] Retrieving objects?

kelly@ug.cs.dal.ca (Michael Kelly) (04/12/91)

This is really a two part question:

1) if PERSON is a class and EMPLOYEE is a subclass of PERSON and 
   TOM is an instance of EMPLOYEE then TOM is a PERSON right?

2) ok, now assuming TOM is a PERSON, but is really an instance of 
   EMPLOYEE, how is TOM stored so that when I ask for all instances
   of PERSON I will get TOM?
   ie. is TOM's object ID somehow associated with the class PERSON?
   I am looking for an answer in terms of persistent storage, ie. if
   I want to save the state of the system to disk and then retrieve
   bits and pieces later how will I know TOM is a PERSON and an
   EMPLOYEE without retrieving everything in the class hierarchy?

Please e-mail any help,
kelly@ug.cs.dal.ca

PS.  Please excuse any obvious demonstrations of ignorance.

kelly@ug.cs.dal.ca (Michael Kelly) (04/12/91)

This is really a two part question:

1) if PERSON is a class and EMPLOYEE is a subclass of PERSON and 
   TOM is an instance of EMPLOYEE then TOM is a PERSON right?

2) ok, now assuming TOM is a PERSON, but is really an instance of 
   EMPLOYEE, how is TOM stored so that when I ask for all instances
   of PERSON I will get TOM?
   ie. is TOM's object ID somehow associated with the class PERSON?
   I am looking for an answer in terms of persistent object storage.
   ie. how is TOM represented if I save my system to disk such that
   I can retrieve the object TOM and know it is a PERSON and an EMPLOYEE?

Please e-mail any help,
kelly@ug.cs.dal.ca

PS.  Please excuse any obvious demonstrations of ignorance.