20-04-2012, 02:58 PM
Inheritance:
INHERITENCE.ppt (Size: 401 KB / Downloads: 45)
Inheritance is a form of software reusability. New classes are created from existing classes by:
absorbing their attributes and behaviours
overriding those with capabilities the new classes require
Software reusability saves time in program development
Why Inheritance
Inheritance is a mechanism for
building class types from existing class types
defining new class types to be a
specialization
Type of inheritance
Three types of inheritance:
public: Derived objects are accessible by the base class objects.
private: Derived objects are inaccessible by the base class
protected: Derived classes and friends can access protected members of the base class
The type of inheritance defines the access level for the members of derived class that are inherited from the base class
High-cost Features
Much of the standard template library
Uses templates: often generates lots of code
Very dynamic data structures have high memory-management overhead
Easy to inadvertently copy large data structures