New topic: 

Can I Create a new class object by the class name?

<http://forums.realsoftware.com/viewtopic.php?t=46164>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        EbenDang          Post subject: Can I Create a new class object 
by the class name?Posted: Thu Dec 06, 2012 10:22 pm                         
Joined: Thu Nov 24, 2011 9:54 am
Posts: 7                In java, we can create an class object by the class 
name!
for example:
Class c = null;  
c = Class.forName("com.zsk.reflection.UserReflection");  
Object o = c.newInstance();  

Can i create a new class object?
Help me, thank you!   
                             Top                npalardy          Post subject: 
Re: Can I Create a new class object by the class name?Posted: Thu Dec 06, 2012 
10:41 pm                       Real Software Engineer          
Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7582
Location: Canada, Alberta, Near Red Deer                No
What is it you're trying to do that makes you think you need this ?      
_________________
My web site Great White Software
RBLibrary.com REALbasic learning  
                             Top                EbenDang          Post subject: 
Re: Can I Create a new class object by the class name?Posted: Thu Dec 06, 2012 
11:05 pm                         
Joined: Thu Nov 24, 2011 9:54 am
Posts: 7                npalardy wrote:No
What is it you're trying to do that makes you think you need this ?

I will create a dialog by the dialog class name.
for example:
i have create some new dialog class named AppDlg1,AppDlg2,... AppDlg100.
Now,i will create a object from the user's input.
i  have done,

function getDlg(name as String) As Object
   if name="AppDlg1" then
    return ( new AppDlg1)
   elif name="AppDlg2"  then
    return (new AppDlg2)
   ....
   elif name="AppDlg100" then
    return (new AppDlg100)
   end

if the realbasic have the function:Create a new class object by the class 
name。
I will execute, for example:
Class c = null;  
c = Class.forName(classname);
Object o = c.newInstance();   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to