How do you check if object o has base type B?

Enjoys Math via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 3 21:51:22 PST 2016


Consider:

class C {

}

class B : C {

}

class A : B {

}

class D : C {

}

C[] objList;

how do we test if objLis[k] is of base type "B"?

Ie for [new A(), new B(), new D(), new C()] would give output 
[true, true, false, false].

?

Thank you! :D




More information about the Digitalmars-d-learn mailing list