4-C - Advanced
4-C - Advanced
4-C - Advanced
com
INTRODUCTION TO TEMPLATES
●
Template Function
●
Template Class
Virtual Functions
Support for Overriding functions in C++
Pure Virtual Functions (Abstract Function)
class A { void func() = 0; };
<A> cannot be instantiated (is abstract)
Multiple Inheritance
class A : public B, public C {...};
POLYMORPHISM – VIRTUAL DTOR
MULTIPLE INHERITANCE
POLYMORPHISM II
MULTIPLE INHERITANCE
Car
name()
POLYMORPHISM II
MULTIPLE INHERITANCE
Car Boat
name() name()
POLYMORPHISM II
MULTIPLE INHERITANCE
Object
cnt
Car Boat
name() name()
POLYMORPHISM II
MULTIPLE INHERITANCE
Object
cnt
Car Boat
name() name()
Amphi
POLYMORPHISM II
MULTIPLE INHERITANCE
Amphi
Car Boat
Object Object
POLYMORPHISM II
MULTIPLE INHERITANCE
Amphi Amphi
class List_item
{
List_item *_next, *_prev;
void *_data;
};
TEMPLATES – CLASS TEMPLATES