digitalmars.D.learn - Dynamic creation of instannce
- maa lagraine.com (11/11) Apr 24 2006 hello
- Jarrett Billingsley (11/15) Apr 24 2006 _What?_
- Deewiant (4/21) Apr 24 2006 If you're looking for runtime reflection, like in Java where you can do
hello I kust we,nt thru a lot of D documentation D solve apparently to me a lot of what I hate In C. But I still have a big question can you in D write new toto; were toto is not a class name but a variable holding a class name or do I have to go thru factories as usual (except that it would be more simplle in D) Thanks Maa
Apr 24 2006
<maa lagraine.com> wrote in message news:e2io95$2cah$1 digitaldaemon.com...can you in D write new toto; were toto is not a class name but a variable holding a class name or do I have to go thru factories as usual_What?_ Are you asking if it's possible to write SomeclassToto; new toto; as a shortcut for SomeClass toto = new SomeClass(); ? If that's what you're asking, then no, there isn't. You can, however, write auto toto = new SomeClass(); Which can save you a couple keystrokes.
Apr 24 2006
maa lagraine.com wrote:hello I kust we,nt thru a lot of D documentation D solve apparently to me a lot of what I hate In C. But I still have a big question can you in D write new toto; were toto is not a class name but a variable holding a class name or do I have to go thru factories as usual (except that it would be more simplle in D) Thanks MaaIf you're looking for runtime reflection, like in Java where you can do something like 'Class c = new Class("Foo")', which would be equivalent to 'Class c = new Foo()', then, no. D doesn't have a reflection API - at least not yet.
Apr 24 2006