Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

By Ivan Ling

Adapted from Absolute C++ Pearson Addison-Wesley, and slides from Dr. JH Khor
• C++ allows the reuse of attributes (variables) and
methods (functions) from one class to another.
• Inheritance happens when you have:
• A base class (aka “parent”)
• A derived class (aka “child”)
• To inherit from a class, the “:” symbol is used.
• A publicly derived class inherits access to every member of
a base class except:
• its constructor and its destructor
• its assignment operator (=)
• its friend
• its private member
• Even though access to the constructor and destructor of
the base class is not inherited , they are automatically
called by the constructor and destructor of the derived
class

You might also like