COPY THIS AND PASTE NOTEPADE FILE AND SAVE AS VIRTUAL.CPP AND RUN IT IN DEVC++ OR DOS BOX (FOR EINDOW 7 )
MS DOS FOR XP USER AND VISTA ALSO
#include<iostream.h>
#include<conio.h>
class intro
{
private:
char name[20];
public:
void input1()
{
cout<<"Enter name:-";
cin>>name;
};
void display1()
{
cout <<"\nName is:-"<<name;
};
};
class edu: public virtual intro
{
private:
float marks;
public:
void input2()
{
cout<<"Enter marks:-";
cin>>marks;
};
void display2()
{
cout<<"\nMarks is:-"<<marks;
};
};
class office:public virtual intro
{
private:
int rank;
public:
void input3()
{
cout<<"Enter the rank:-";
cin>>rank;
};
void display3()
{
cout<<"\nRank is:-"<<rank;
};
};
class biodata: public edu,public office
{
public:
void input4()
{
input1();
input2();
input3();
};
void display4()
{
display1();
display2();
display3();
};
};
void main()
{
clrscr();
biodata obj1;
obj1.input4();
obj1.display4();
getch();
}
No comments:
Post a Comment