CBSE Computer Science - Revision Tour(Solved)

CBSE Guess > eBooks > Class XII > CBSE Computer Science inheritane Solved Revision Tour By Mr. Ravi Kiran

COMPUTER SCIENCE INHERITANCE

Previous Index Next

DELHI 2006:

2.a) Define Multilevel and Multiple inheritance in context of Object Oriented Programming. Give suitable example to illustrate the same.

2

Ans:
Multilevel Inheritance: When a subclass inherits from a class that itself inherits from another class, it is known as multilevel inheritance.


Eg: (for Multi Level Inheritance)

class A
{
-----
------
}
class B:public class A
{
-----
-----
}
class C:protected B
{
-----
-----
}

Multiple Inheritance: When a sub class inherits from multiple base classes, it is known as multiple inheritance.

Eg: (for Multiple Inheritance)
class A
{
-----
------
}
class B
{
-----
-----
}
class C:public A,protected B
{
-----
-----
}

 

Previous Index Next

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )