Chapter – 6. INHERITANCE

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
{
-----
-----
}


Warning: include_once(../../ebooks-footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_c.php on line 121

Warning: include_once(): Failed opening '../../ebooks-footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_c.php on line 121

Warning: include_once(../../../footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_c.php on line 123

Warning: include_once(): Failed opening '../../../footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_c.php on line 123