Thanks, that works.

On Mon, Aug 9, 2010 at 12:21 AM, Adam Ruppe <[email protected]>wrote:

> On 8/8/10, Andrej Mitrovic <[email protected]> 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;
>        writeln(typeid(typeof(o)));
> }
> ====
> Prints: test6.Something
>

Reply via email to