Public Inheritance: Not Visa-Versa
Public Inheritance: Not Visa-Versa
Public Inheritance
• Used to denote an IS-A relationship
• If derived class D publicly inherits from
C++ Inheritance base class B, then every object of D can
be used wherever a B may be used, but
not visa-versa.
Chapter 6
• Syntax: class D : public B
• Math can trip you up
– Is a square a rectangle?
1
10/15/2009
2
10/15/2009
3
10/15/2009
4
10/15/2009
5
10/15/2009
6
10/15/2009