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
Which type does string inherit from?
Whats oop mean?
How to call a non virtual function in the derived class by using base class pointer
Explain the concepts involved in Object Oriented programming.
Can we override main method?
What is multilevel inheritance?
What are functions in oop?
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
What is the benefit of oop?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
what are the ways in which a constructors can be called?
What is polymorphism programming?
Is oop better than procedural?
What do you mean by variable?
How do you define a class in oop?