Inheritance:

In order to maintain and reuse the class objects easily, it is required to relate different classes. Two or more classes can be related under a given relationship. Such a relationship between classes can be referred to as “has a” relationship i.e. class A “has a” relationship with class B.



Inheritance is one of the most powerful features of OOP. Reusability is the basic objective behind inheritance. When a class needs some of the features of a previous class we can easily inherit those features without rewriting them, thus avoiding code repetition. C++ strongly supports the reusability concept in several ways. A class may be derived from one or more classes or from one or more levels, if the derived class is obtained using one base class it is called single inheritance. if the derived class is obtained using more than one base class it is called multiple inheritance. On the other hand if the same base class is used to derive more number of derived classes it is referred to as hierarchical inheritance. If a class is derived from another derived class, then the process is called multilevel inheritance. In case different types are combined, then it is called hybrid inheritance. The main advantages of inheritance are


Posted by Unknown On 22:37 No comments

0 comments:

Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Blog Archive

Contact Us


Name

E-mail *

Message *