#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class common
{
int rl,ph;
char na[30];
public:
void getdata()
{
cout<<"\nEnter the name ";
gets(na);
cout<<"\nEnter the ID";
cin>>rl;
cout<<"\nEnter the phone no ";
cin>>ph;
}
void showdata()
{
cout<<"\nThe details are=\n"<<na<<"\n"<<rl<<"\n"<<ph;
}
};
class education
{
char uni[20];
char sess[10];
char res[10];
public:
void getmarks()
{
}
void showmarks()
{
}
};
class student: public common, public education
{
int m;
public:
void getderiveddata()
{
common::getdata();
cout<<"\n Enter marks=";
cin>>m;
}
void showderiveddata()
{
common::showdata();
cout<<m;
}
};
class test:public student
{
};
class employee: public common
{
int sal;
public:
void getderivedd1data()
{
common::getdata();
cout<<"\n Enter salary=";
cin>>sal;
}
void showderivedd1data()
{
common::showdata();
cout<<sal;
}
};
void main()
{
student s;
s.getderiveddata();
s.showderiveddata();
employee e;
e.getderivedd1data();
e.showderivedd1data();
getch();
}
#include<conio.h>
#include<stdio.h>
class common
{
int rl,ph;
char na[30];
public:
void getdata()
{
cout<<"\nEnter the name ";
gets(na);
cout<<"\nEnter the ID";
cin>>rl;
cout<<"\nEnter the phone no ";
cin>>ph;
}
void showdata()
{
cout<<"\nThe details are=\n"<<na<<"\n"<<rl<<"\n"<<ph;
}
};
class education
{
char uni[20];
char sess[10];
char res[10];
public:
void getmarks()
{
}
void showmarks()
{
}
};
class student: public common, public education
{
int m;
public:
void getderiveddata()
{
common::getdata();
cout<<"\n Enter marks=";
cin>>m;
}
void showderiveddata()
{
common::showdata();
cout<<m;
}
};
class test:public student
{
};
class employee: public common
{
int sal;
public:
void getderivedd1data()
{
common::getdata();
cout<<"\n Enter salary=";
cin>>sal;
}
void showderivedd1data()
{
common::showdata();
cout<<sal;
}
};
void main()
{
student s;
s.getderiveddata();
s.showderiveddata();
employee e;
e.getderivedd1data();
e.showderivedd1data();
getch();
}
No comments:
Post a Comment