If you access an object of the derived class through a pointer of the parent class type, you will get the names defined in the parent class. This is because the compiler cannot tell at runtime whether a parent class pointer refers to a sub-class. The only safe assumption is that the object is of the parent class.
This is usually referred to as static binding. We shall see later how to make sub-class definitions visible through a parent class pointer, when we consider virtuals.
Next note in series
Back to index