www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - constructing via typeid

reply "Carlos Santander B." <carlos8294 msn.com> writes:
If I have something like this:

//////////
class A {}

void main ()
{
    foo( typeid(A) );
}

void foo ( TypeInfoClass tic )
{
    Object o = new tic.ctor;
}
//////////

Well, I know that doesn't work, but hopefully you get the idea. Is there a
way to do it? If not, will there be?

BTW, the real code is not as simple as the one I showed, so I can't use a
template for this.

-----------------------
Carlos Santander Bernal
Jul 02 2004
parent "Walter" <newshound digitalmars.com> writes:
I see your point. It might be possible for 2.0.
Jul 04 2004