bearophile wrote:
Georg Wrede:
When creating templates, it is sometimes handy to print the type of something. Is there a trivial way to print it?

writeln("Typeof T is: ", typeid(typeof(t)));

(Try alternatives of that with a dynamic type, like a class).

Thanks!!!


    class A { }
    class B : A { }
    class C : B { }
    A a;
    B b;
    C c;
    A ac = new C;

Typeof ac is: A

So it's the variable, not its current contents. Kinda makes sense.

Reply via email to