Dynamic creation of instannce

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Apr 24 08:33:45 PDT 2006


<maa at lagraine.com> wrote in message news:e2io95$2cah$1 at 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. 





More information about the Digitalmars-d-learn mailing list