query interface

Qian Xu quian.xu at stud.tu-ilmenau.de
Wed Jan 21 07:33:05 PST 2009


Qian Xu wrote:

> Hi All,
> 
> can D check, whether a class A an Interface B supports?
> 
> like:
> 
>   if (supports(class_A, intf_B))
>   {
>      cast(intf_B) (class_A).hello();
>   }
> 
> --Qian

what I have found is:

  if (is(class_A == intf_B))
  {
    cast(intf_B) (class_A).hello();
  }

Is there any better one?

--Qian


More information about the Digitalmars-d-learn mailing list