RE: [Dev-C++] Help with creating objects dynamically
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Satish M. <sat...@ya...> - 2003-07-21 17:36:11
|
Hello Marc, Thank you for your reply. There is no real necessity for me to do so.. I can make it work using a hash table or some kind of a mapping function.. I just thought that if it was possible in the way I earlier asked, I could save some execution time as there will not be much need for searching operation.. As i got almost every feedback saying that this is not possible, I think I will stick to a hash table solution. Thank you for all your help with this. -Sateesh Medepalli --- Marc Heiligers <ma...@e-...> wrote: > I can see absolutely no requirement to do this at all. In addition (and > to > answer the question) I can see absolutely no way of doing it either. > Scripting languages that have some kind of eval statement could do this, > but > again, I can see no requirement for it (although I have used a similar > mechanism in a JScript ASP project to create objects of a particular > name, > but never dependant on data within the object itself). > > Maybe if you enlighten us on why you would want to do this, we could > help > you find a solution. > > __________________________________ > Marc Heiligers > > > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Satish > Medepalli > Sent: 21 July 2003 06:28 > To: dev...@li... > Subject: [Dev-C++] Help with creating objects dynamically > > Hello, > > I have the following requirement while creating objects.. I will try > to > explain it using a small example.. > > Suppose I have a class Student defined and I want to create objects > of > type Student inside the main function.. > > And say, the actual name with which i want to create the obect is > stored in a character array at run time.. say i have the following > statement > char NAME[]=getName(); > and the above function is returning the name "JOHN" at run time. > > Now i want to get the name out of the character array and create the > object using that particular name at run time.. i.e., > Student JOHN; > > in a nutshell i want to give the name of the objects to be created at > run time. IS THIS POSSIBLE?? IF SO CAN ANYONE HELP ME WITH THIS?? > > Thank You in advance. > -Sateesh Medepalli > > __________________________________ > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! > http://sbc.yahoo.com > > __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com |