Like getClass()
Sergey Gromov
snake.scaly at gmail.com
Sun Sep 28 16:02:58 PDT 2008
Mon, 29 Sep 2008 01:12:45 +0400,
Denis Koroskin wrote:
> On Sun, 28 Sep 2008 04:42:15 +0400, Sergey Gromov <snake.scaly at gmail.com>
> wrote:
>
> > Sat, 27 Sep 2008 19:21:56 -0400,
> > Christopher Wright wrote:
> >> Since .classinfo is essentially a virtual call, and interface vtbls are
> >> filled from the class's vtbl, it shouldn't in theory be terribly
> >> difficult to change this. Of course, I'd have to check the dmd source to
> >> be sure.
> >
> > I'd say it's a bug. Classinfo is for runtime class, and runtime class
> > can never be an interface.
>
> Do all IUknown interface instances have classinfo member? That's not a bug
> if they don't. That's the same reason why interfaces can't be casted to
> Object.
IUnknown cannot be a D interface because it does not comply with D ABI.
IUnknown cannot have any .classinfo. Iunknown cannot be cast to
anything except by the means of QueryInterface(). You've chosen the
wrong example.
Only D interfaces can have .classinfo. You cannot instantiate a D
interface, only a class. Therefore whenever you get a reference it's
either null or refers to an instantiated *class* which definitely has
its one and only correct .classinfo.
More information about the Digitalmars-d-learn
mailing list