Académique Documents
Professionnel Documents
Culture Documents
www.lsp4you.com
Early Binding or
Compile Time Polymorphism
Late Binding or
Run Time Polymorphism
class A
{
int x;
public:
void show( ) {}
};
class B : public A
{
int y;
public:
void show( ) {}
};
Late Binding or
Run Time Polymorphism
Polymorphism
Compile time
Function
Overloading
Run time
Operator
Overloading
Virtual
Functions
Achieving Polymorphism
Pointer To Objects
run time.
An object pointer can be used to access the
Pointer To Objects
class item
{
int code;
float price;
public:
void getdata( int a, float b )
{ code =a; price = b;}
void show( void )
{ cout << Code : << code<<endl;
<< Price : << price << endl; }
};
item x;
item *ptr = &x;
continue
Pointer To Objects
continue
pointers
this Pointer
Virtual Functions
Virtual Functions
continue
Virtual Functions
continue
some class.
They cannot be static members.
They are accessed by using object pointers.
A virtual function can be a friend of another
class.
A virtual function in a base class must be
defined, even though it may not be used.
Thank You