Polymorphism in regular variadic function
Bill Baxter
dnewsgroup at billbaxter.com
Tue Dec 5 16:25:25 PST 2006
Jarrett Billingsley wrote:
> Heheh.. I did something like:
>
> TypeInfo ti = _arguments[i];
> TypeInfo_Class tic = cast(TypeInfo_Class)ti;
>
> if(tic)
> {
> ClassInfo ci = tic.info;
>
> for( ; ci !is null; ci = ci.base)
> if(ci == Foo.classinfo)
> {
> // it's derived, do what you will
> }
>
> if(ci is null)
> {
> // we got to the base without finding Foo,
> // it's not derived from Foo
> }
> }
>
I added this tip to the comments page for Phobos/object.
http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Phobos/Object
--bb
More information about the Digitalmars-d-learn
mailing list