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

ဆိုလာ စနစ္ရွိ BATTERY AMPACITY အား design ထုတ္တြက္ခ်က္ၿခင္း (1) watt hour ရယူၿခင္း