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

Popular posts from this blog

serial to parallel test with 74c595 and pic mcu

INTERRUPT_ON_CHANGE_18f4550