Program to implement the concept of pure virtual function.

#include
#include
class base
{
private :
int x ;
float y ;
public :
virtual void getdata () = 0 ;
virtual void putdata () = 0 ;
} ;
class derived: public base
{
private :
long int rollno ;
char name [20] ;
public :
void getdata();
void putdata();
};
void base :: getdata()
{
}
void base :: putdata()
{
}
void derived :: getdata()
{
cout<> rollno;
cout<> name;
}
void derived :: putdata()
{
cout<<"nroll number and name of student isn";
cout<<"nRoll No tName" ;
cout<<"n"<<rollno<<"tt"<getdata();
ptr->putdata();
getch();
}

Leave a reply