typeof reference to class object

Steve Teale steve.teale at britseyeview.com
Thu Mar 19 03:20:40 PDT 2009


import std.stdio;

class A
{
   int a;
}

class B
{
   int b;
}

void main()
{
   int n;
   Object a = new A;
   Object b = new B;

   writefln("%s %s %s", typeof(n).stringof, typeof(a).stringof, typeof(b).stringof);
}

prints int Object, Object.

This seems somewhat counter-intuitive for an object oriented language!



More information about the Digitalmars-d mailing list