Computer Science, asked by aaima001likgmailcom, 8 months ago

Write a class that contains an attribute name, a function to input, and a function to display name, create a array of pointers in which each elements refers to an object of the class using polymorphism​

Answers

Answered by mrekha6789
0

Answer:

tjstdjll4edho94gkli7

Explanation:

titdjlo6dnlo6ednki

Answered by zara41610
0

Answer:

#include<iostream>

using namespace std;

class person

{

private:

char name[50];

public:

void get()

{

cout<<"Enter name";

cin>>name;

}

void show()

{

cout<<"name is"<<name<<endl;

}

};

int main()

{

person*ptr[5];

int i;

for(i=0;i<5;i++)

{

ptr[i]=new person;

ptr[i]->get();

}

for(i=0;i<5;i++)

{

ptr[i]->show();

}

return 0;

}

Similar questions