Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - array of pointer to classes...
I'm confused by declarations. I'm trying to dynamically create an array of pointers to classes. so: #include <stdio.h> #include <string.h> class emails { public: emails(){}; emails(char *FName, char *LName, char *EMail, int ID){ strcpy(fname, FName); strcpy(lname, LName); strcpy(email , EMail); id = ID; }; char * GetName() const { return strcat(fname,lname);}; void SetName(char * Fname, char *Lname){ strcpy(fname, Fname); strcpy(lname, Lname); } char * GetEmail() const { return email;}; void SetEmail( char * EMail) { strcpy(email,EMail);}; private: char fname[50]; char lname[50]; char email[50]; int id; }; void main(int argc, char *argv[]) { { /* Print a prompt prior to exiting so that you can view output */ emails *local_emails[]; // I read this as: local_mails is an array of pointers to emails...however... the compiler tells me size of array is not known...ok so emails **local_emails; //it doesn't like this either...can I do something like this in C++???? local_emails = new emails[10]; printf("Press a character....\n"); getch(); } } Sep 23 2002
Michael Comperchio wrote:{ /* Print a prompt prior to exiting so that you can view output */ emails *local_emails[]; // I read this as: local_mails is an array of pointers to emails...however... the compiler tells me size of array is not known...ok so emails **local_emails; Sep 23 2002
Jan Knepper wrote:Michael Comperchio wrote:{ /* Print a prompt prior to exiting so that you can view output */ emails *local_emails[]; // I read this as: local_mails is an array of pointers to emails...however... the compiler tells me size of array is not known...ok so emails **local_emails; Sep 23 2002
Michael Comperchio wrote:I'm confused by declarations. I'm trying to dynamically create an array of pointers to classes. so: Sep 26 2002
|