typeid() woes

Adam Ruppe destructionator at gmail.com
Sun Aug 8 15:21:38 PDT 2010

On 8/8/10, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> I wonder if there's a way to get the static type, is there an equivalent
> function like typeid() for such a case?

Try this:

      typeid(typeof( X ));

typeof() returns the static type of the variable. Then, you can get
the typeid of that returned static type.

Here's a sample program:
import std.stdio;
class Something { }
class SomethingElse : Something {}

void main() {
        Something o = new SomethingElse;
Prints: test6.Something

More information about the Digitalmars-d mailing list