#include<iostream.h>
#include<conio.h>
class father
{
private:
                int age;
                char name[20],profession[25];
public:
                void read()
                {
                                cout<<"Enter Father Name:- ";
                                cin>>name;
                                cout<<"Enter Profession:- ";
                                cin>>profession;
                                cout<<"Enter Age:- ";
                                cin>>age;
                }
                void show()
                {
                                cout<<"\nFather Name:- "<<name;
                                cout<<"\nProfession:- "<<profession;
                                cout<<"\nFather Age:- "<<age;
                }
};
class student:public father
{
private:
                int roll;
                char name[20],division[10];
public:
                void input()
                {
                                father::read();
                                cout<<"Enter Student Name:- ";
                                cin>>name;
                                cout<<"Enter Roll No:- ";
                                cin>>roll;
                                cout<<"Enter Division:- ";
                                cin>>division;
                }
                void output()
                {
                                father::show();
                                cout<<"\nStudent Name:- "<<name;
                                cout<<"\nRoll No:- "<<roll;
                                cout<<"\nDivision:- "<<division;
                }
};
void main()
{
                clrscr();
                student s;
                s.input();
                cout<<endl;
                s.output();
                getch();
}
Advertisements