Answer Posted / aashi
#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 ? | 2 Yes | 4 No |
Post New Answer View All Answers
Why is polymorphism needed?
What is the renewal class?
What is for loop and its syntax?
what is difference between class template and template class?
What is the difference between encapsulation and polymorphism?
What is oops with example?
What is abstraction encapsulation?
What makes a language oop?
What causes polymorphism?
What is purpose of inheritance?
What is class and object in oops?
What is oops?what is its use in software engineering?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is solid in oops?
Why do we need polymorphism in c#?