Program -
#include<iostream.h>
#include<conio.h>
class abc
{
char name[20];
public:
void input()
{
cout<<"enter
name==>";
cin>>name;
}
void print()
{
cout<<"name
is"<<name<<endl;
}
};
class ba:private
abc
{
int rollno;
public:
void getdata()
{
input();
cout<<"enter
rollno==>";
cin>>rollno;
}
void putdata()
{
print();
cout<<"rollno
is==>"<<rollno;
}
};
void main()
{
clrscr();
ba a;
a.getdata();
a.putdata();
getch();
}
Output -
enter
name==>anu
enter
rollno==>23
name is anu
rollno is==>23
0 comments:
Post a Comment