Example:
#include<iostream.h>
#include<conio.h>
class teacher
{
private :
int id;
char name[20];
public:
void get();
void put();
};
void
teacher::get()
{
cout<<”Enter teacher Info =
”;
cin>>id>>name;
}
void
teacher::put()
{
cout<<” teacher Info = ”;
cout<<id<<name;
}
class
principle: public teacher
{
double salary;
public:
void getdata();
void putdara();
};
void
principle :: getdata()
{
cout<<”Entry Salary = ”;
cin>>salary;
}
void
principle :: putdata()
{
cout<<salary;
}
void main()
{
clrscr();
principle
p;
p.get();
p.getdata();
p.put();
p.putdata();
getch();
}
No comments:
Post a Comment