How can I do the following?
Ohh and the name has to supplyed at runtime.Code:
Student *sa[3];
*sa[0] = new Student("James");
*sa[1] = new Student("Jason");
*sa[2] = new Student("Frank");
Printable View
How can I do the following?
Ohh and the name has to supplyed at runtime.Code:
Student *sa[3];
*sa[0] = new Student("James");
*sa[1] = new Student("Jason");
*sa[2] = new Student("Frank");
You should be able to figure out how to supply the name at run-time unless there's some specific problem that's going to occur but from the minuscule information you provided I'm not sure how to know what's really going on in your program.Code:
Student *sa[3];
sa[0] = new Student("James");
sa[1] = new Student("Jason");
sa[2] = new Student("Frank");
I swear I tryed that. Ohh well works now.
Thanks very much
Quote:
Originally Posted by (Slith++)
You don't need the dereference operator on each element. Remove them.