Program -
#include<iostream.h>
#include<conio.h>
class abc
{
char name[20];
public:
void input()
{
cout<<"enter the name==>";
cin>>name;
}
void print()
{
cout<<"\n\n";
cout<<"name is"<<name<<endl;
}
};
class as
{
int marks;
public:
void input()
{
cout<<"enter the marks==>";
cin>>marks;
}
void print()
{
cout<<"marks obtained are"<<marks<<endl;
}
};
class sus:public abacas
{
int roll;
public:
void getdata()
{
abc::input();
cout<<"enter the number==>";
cin>>roll;
as::input();
}
void putdata()
{
abc::print();
cout<<"roll number is"<<roll<<endl;
as::print();
}
};
void main()
{
clrscr();
sus s;
s.getdata();
s.putdata();
getch();
}
Output -
enter the name==>Mohan
enter the number==>12
enter the marks==>786
name is Mohan
roll number is12
marks obtained are786
0 comments:
Post a Comment