.classinfo by Class name

Adam Adam at Anizi.com
Thu Dec 1 13:48:22 PST 2011


Hello again!

A third question on D:
 Is there an argument type I can provide for a method signature
which would require a user to provide classinfo or a class name for
a class of a particular type?

That is, suppose I have a Class called "Fruit".
Is there some constraint I can impose, either in the method
signature or via static assert, which would require that the
argument of some function is a classinfo for Fruit or a subclass of
Fruit (Apple, Orange, etc)?

classinfo seems to provide a "interfaces[]" member, but I'm unsure
if this is representative of a types whole hierarchy or if it must
be browsed.


More information about the Digitalmars-d-learn mailing list