#include<iostream.h>
#include<conio.h>
class mahi
{
public:
char name1[20],name2[20];
void putdata()
{
cout<<"\n Enter The Name1: ";
cin>>name1;
cout<<"\n Enter The Name2: ";
cin>>name2;
}
};
class bhavna: public mahi
{
public:
int age1,age2;
void putdata1()
{
cout<<"\n Enter Age of "<<name1<<" : ";
cin>>age1;
cout<<"\n Enter Age of "<<name2<<" : ";
cin>>age2;
}
};
class all:public bhavna
{
public:
void show()
{
cout<<"\n Name1 : "<<name1;
cout<<"\n Age1 : "<<age1;
cout<<"\n name2 : "<<name2;
cout<<"\n Age2 : "<<age2;
}
};
void main()
{
clrscr();
all a1;
a1.putdata();
a1.putdata1();
a1.show();
getch();
}
#include<conio.h>
class mahi
{
public:
char name1[20],name2[20];
void putdata()
{
cout<<"\n Enter The Name1: ";
cin>>name1;
cout<<"\n Enter The Name2: ";
cin>>name2;
}
};
class bhavna: public mahi
{
public:
int age1,age2;
void putdata1()
{
cout<<"\n Enter Age of "<<name1<<" : ";
cin>>age1;
cout<<"\n Enter Age of "<<name2<<" : ";
cin>>age2;
}
};
class all:public bhavna
{
public:
void show()
{
cout<<"\n Name1 : "<<name1;
cout<<"\n Age1 : "<<age1;
cout<<"\n name2 : "<<name2;
cout<<"\n Age2 : "<<age2;
}
};
void main()
{
clrscr();
all a1;
a1.putdata();
a1.putdata1();
a1.show();
getch();
}
No comments:
Post a Comment