lecture-16 - 29 Multilevel Hierarchy • One can build...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
29 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT Multilevel Hierarchy • One can build hierarchies that contain as many layers of inheritance as we like. • It is perfectly accetable to use a derived class as a base class of another.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
30 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT
Background image of page 2
31 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
32 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT
Background image of page 4
33 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT Info for t1: Triangle is right Width and height are 8 and 12 Color is Blue Area is 48 Info for t2: Triangle is isosceles Width and height are 2 and 2 Color is Red Area is 2
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
34 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT Inheriting Multiple Base Classes • In C++, it is possible for a derived class to inherit two or more base classes at the same time • To make more than one base class to be inherited, one must use a comma- separated list preceded by the access specifier for each base class inherited
Background image of page 6
35 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
36 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT Output: 10 20
Background image of page 8
37 Object Oriented Programming C++ Inheritance and Polymorphism Part - 1 R.B. Lenin Winter 2006 DA-IICT When Constructors and Destructors are Called • When a derived object is created, – the base class constructor is called first, followed by the constructor for the derived class • When a derived object is destroyed, – its destructor is called first, followed by that of the base class
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

lecture-16 - 29 Multilevel Hierarchy • One can build...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online