Pointer to object array
#include<iostream.h>
using namespace std;
class name{
private:
char nm[20];
public:
void get()
{cout<<"Enter name:";
cin>>nm;
}
void show()
{cout<<nm<<endl;
}
};
int main(int argc, char *argv[])
{
name* p[100];
char c;
int n=0;
do{
p[n]->get();
cout<<"mire name:";
cin>>c;
}while(c=='y');
do{
p[n]->show();
}while(n>=0);
return 0;
}
Comments
Post a Comment