Assignment on principles of inheritance and variation
Answers
Answered by
1
Single Inheritance: In this type of Inheritance, only one class is derived from a single class (Base class). In an example below, Class B is derived from Class A. That means Class B will be having access to data members and member functions of Class A. Another example can be oe student can have only one id in college to access its information.

Multiple Inheritance: In this type of Inheritance, a class is derived from more than one super class. There can be more than one Super class and only one derived class. One derived class will implement properties of many Super classes. In this example, Class A extends properties of 3 Super Class, Class B, Class C and Class D. Another example can be many students belong to only one college.

Hierarchical Inheritance: In this type of Inheritance, one super class can have multiple deriving classes. There can be many classes deriving only one super Class. In this example, Class A is having 3 derived classes Class B, Class C and Class D. 3 derived classes will extend prosperities of single base class, Class A. Another example can be One Universities can have multiple colleges affiliated.

Multilevel Inheritance: In this type of Inheritance, Classes are inherited in the form of levels. For example, figure shows that Class C is derived from Class B and Class B is derived from Class A. Therefore , Inheritance can be carried out in multiple levels.

The derived class with multilevel inheritance can be declared as follows:
class A{……..};
class B extends A{….};
class C extends B{….};
The process can be extended to any number of levels.
Hybrid Inheritance: Sometimes, there is a need to implement more than one type of inheritances. In such situations, we combine two or more types of inheritances and design a Hybrid Inheritance. Given figure shows, Class B and Class D have single Inheritance designed, whereas Class A has two derived classes class B and Class C. In this Hybrid Inheritance has been carried out combining Single and Multiple Inheritance.


Multiple Inheritance: In this type of Inheritance, a class is derived from more than one super class. There can be more than one Super class and only one derived class. One derived class will implement properties of many Super classes. In this example, Class A extends properties of 3 Super Class, Class B, Class C and Class D. Another example can be many students belong to only one college.

Hierarchical Inheritance: In this type of Inheritance, one super class can have multiple deriving classes. There can be many classes deriving only one super Class. In this example, Class A is having 3 derived classes Class B, Class C and Class D. 3 derived classes will extend prosperities of single base class, Class A. Another example can be One Universities can have multiple colleges affiliated.

Multilevel Inheritance: In this type of Inheritance, Classes are inherited in the form of levels. For example, figure shows that Class C is derived from Class B and Class B is derived from Class A. Therefore , Inheritance can be carried out in multiple levels.

The derived class with multilevel inheritance can be declared as follows:
class A{……..};
class B extends A{….};
class C extends B{….};
The process can be extended to any number of levels.
Hybrid Inheritance: Sometimes, there is a need to implement more than one type of inheritances. In such situations, we combine two or more types of inheritances and design a Hybrid Inheritance. Given figure shows, Class B and Class D have single Inheritance designed, whereas Class A has two derived classes class B and Class C. In this Hybrid Inheritance has been carried out combining Single and Multiple Inheritance.

Answered by
257
Inheritance is the process by which characters are passed on from parent to progeny; it is the basis of heredity. Variation is the degree by which progeny differ from their parents. Humans knew from as early as 8000-1000 B.C. that. one of the causes of variation was hidden in sexual. reproduction.
Similar questions