Answer Posted / manoj shukla
#include<constream.h>
#include<iostream.h>
class A
{
protected:
char name[20];
};
class B:public A
{
protected:
int age;
};
class C:public A
{
char adress[100];
void getdata()
{
cout<<"enter the name:-";
cin>>name;
cout<<"enter the age:-";
cin>>age;
cout<<"enter the adress:-";
cin>>adress;
}
void show()
{
cout<<"name"<<name<<"\n\n age"<<age<<"\n\nadress:-"<<adress;
getdata();
}
void main()
{
clrscr()
C K;
K.show();
getch();
}
| Is This Answer Correct ? | 5 Yes | 7 No |
Post New Answer View All Answers
Can a destructor be called directly?
What is encapsulation process?
What is advantage of inheritance?
Why is polymorphism needed?
What is difference between polymorphism and inheritance?
What is oops?what is its use in software engineering?
Who invented oop?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
What is protected in oop?
What is inheritance in simple words?
What is encapsulation example?
What are the important components of cohesion?
What is inheritance and how many types of inheritance?
How Do you Code Composition and Aggregation in C++ ?
What is constructor in oop?