Std.is(someClass, SomeInterface) always returns true for cpp

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Std.is(someClass, SomeInterface) always returns true for cpp

Dion Whitehead Amago
As the title says, Std.is() doesn't work for interfaces for the cpp target.

class TestStdIs
{
     public function new ()
     {
         var foo = new Foo();
         trace(Std.is(foo, Foo)); //traces true
         trace(Std.is(foo, IFoo)); //traces true
         trace(Std.is(foo, IBar)); //traces true, but it's false
         trace(Std.is(foo, String));  //traces false
     }
}

class Foo implements IFoo
{
     public function new ()
     {

     }

     public function foo() :Void
     {
     }
}

interface IFoo
{
     function foo() :Void;
}
interface IBar
{
     function bar() :Void;
}

Dion

--
haXe - an open source web programming language
http://haxe.org