www.digitalmars.com         C & C++   DMDScript  

D - Interfaces problem

reply Vathix <vathix dprogramming.com> writes:
Should this cast work? the assertion fails:


interface IFoo { }
class Foo: IFoo { }

int main()
{
    IFoo f = new Foo;
    assert(cast(Foo)f !== null);
    return 0;
}


-- 
Christopher E. Miller
Mar 02 2004
parent reply Justin Henzie <Justin_member pathlink.com> writes:
is the !== deliberate or a typo?


In article <c21jug$1dhe$1 digitaldaemon.com>, Vathix says...
Should this cast work? the assertion fails:


interface IFoo { }
class Foo: IFoo { }

int main()
{
    IFoo f = new Foo;
    assert(cast(Foo)f !== null);
    return 0;
}


-- 
Christopher E. Miller

Mar 03 2004
parent Sean Kelly <sean ffwd.cx> writes:
Justin Henzie wrote:

 is the !== deliberate or a typo?

Deliberate. D uses a few odd comparison operators to differentiate whether the objects themselves are being compared or jus the references to them. Sean
Mar 03 2004