Object Oriented Programming - Part 2
- Polymorphism is rendered possible by the fact that a pointer to a
base class instance may also point to any subclass instance.
- A virtual function is a member function that you expect to be redefined in a derived class. When you call a virtual function through a pointer to a base class, the derived class's version of the function is executed. This is precisely the opposite behaviour of ordinary member functions.
- The first obvious use of a reference is to determine if the address of an object and not the object itself should be passed to an output function.
- A reference is an alternative name for an object.The primary use of references is for the specification of operations on user defined types.
- The terms
a) method/member function
b) instance variable/member data
c) subclass/derived class
d) parent class/base class can be used interchangeably.
- Prototype: A recent theory of classification where any
object can be inherited from or cloned to serve as a prototype for
newly created instances.
- Delegation refers to delegating the search for an attribute to a
delegate and is therefore more of a pure message passing mechanism (as with
dynamic scoping) than inheritance.
- Encapsulation is the process of hiding all of the details of an object that do not contribute to its essential characterisitcs.
- A pure virtual function requires no definition; you do not have to write the body of
Employee:: compute pay
It is intended to be redefined in all derived classes.
In the base class, the function serves no purpose except to provide a
polymorphic interface for the derived classes. \hs {\sf [P134 MS]
20. Private members are only accessible from within a class.