#include<iostream.h>
#include<conio.h>
Class Stuinfo
{
Private:
Char name [25];
Int roll;
Public:
Void getdata ()
{
Cout<<”\n Enter name”;
Cin>>name;
Cout<<”\n Enter roll”;
Cin>> roll;
}
Void display ()
{
Cout<<”\n name=”<<name;
Cout<<”\n Roll number”<<roll;
}
};
Class Stuacademicinfo
{
Private:
Char course [25];
Char semester [15];
Public:
Void getdata ()
{
Cout<<”\n Enter course name”;
Cin>>course;
Cout<<”\n Enter semester”;
Cin>>semester;
}
Void display ()
{
Cout<<”\n Course “<<course;
Cout<<”\n semester”<<semester;
};
Class stuaddressinfo: public Stuinfo, public Stuacademicinfo
{
Private:
Char address [25];
Public:
Void getdata ()
{
Stuinfo:: getdata ();
Stuacademicinfo:: getdata ();
Cout<<”\n Enter the address”;
Cin>>address;
}
Void display ()
{
Stuinfo:: display ();
Stuacademic:: display ();
Cout <<”\n Address”<<address;
};
Void main ()
{
Stuaddressinfo obj;
Obj .getdata ();
Obj.dispay ();
getch ();
}
#include<conio.h>
Class Stuinfo
{
Private:
Char name [25];
Int roll;
Public:
Void getdata ()
{
Cout<<”\n Enter name”;
Cin>>name;
Cout<<”\n Enter roll”;
Cin>> roll;
}
Void display ()
{
Cout<<”\n name=”<<name;
Cout<<”\n Roll number”<<roll;
}
};
Class Stuacademicinfo
{
Private:
Char course [25];
Char semester [15];
Public:
Void getdata ()
{
Cout<<”\n Enter course name”;
Cin>>course;
Cout<<”\n Enter semester”;
Cin>>semester;
}
Void display ()
{
Cout<<”\n Course “<<course;
Cout<<”\n semester”<<semester;
};
Class stuaddressinfo: public Stuinfo, public Stuacademicinfo
{
Private:
Char address [25];
Public:
Void getdata ()
{
Stuinfo:: getdata ();
Stuacademicinfo:: getdata ();
Cout<<”\n Enter the address”;
Cin>>address;
}
Void display ()
{
Stuinfo:: display ();
Stuacademic:: display ();
Cout <<”\n Address”<<address;
};
Void main ()
{
Stuaddressinfo obj;
Obj .getdata ();
Obj.dispay ();
getch ();
}
No comments:
Post a Comment