Summary

In this hour, you learned how derived classes inherit from base classes. Classes inherit all the public and protected data and functions from their base classes.

Protected access is public to derived classes and private to all other objects. Even derived classes cannot access private data or functions in their base classes.

Member variables can be initialized before the body of the constructor. It is at this time that base constructors are invoked and parameters can be passed to the base class.

Methods in the base class can be invoked by explicitly naming the function with the prefix of the base class name and two colons. For example, if Dog inherits from Mammal, Mammal's walk() method can be called with Mammal::Walk().

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.204.201