Thread overview
Classinfo of a base class.
Nov 04, 2004
Walter
Nov 04, 2004
Thomas Kuehne
Nov 04, 2004
larrycowan
Nov 04, 2004
Walter
November 03, 2004
I would want to use the classinfo property of the base class in the static constructor of a template class, but the closest I could get was passing the class as an alias parameter:

class Test(alias BaseClass)
{
    static this()
    {
        writefln(BaseClass.classinfo.name);
    }
}

class TestBase : Test!(TestBase)
{
}

Is there any other way to print the name of the base class in the static constructor?

Thanks
November 04, 2004
super.classinfo.name should work.

"Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:cmbofh$10o6$1@digitaldaemon.com...
> I would want to use the classinfo property of the base class in the static constructor of a template class, but the closest I could get was passing the class as an alias parameter:
>
> class Test(alias BaseClass)
> {
>      static this()
>      {
>          writefln(BaseClass.classinfo.name);
>      }
> }
>
> class TestBase : Test!(TestBase)
> {
> }
>
> Is there any other way to print the name of the base class in the static constructor?
>
> Thanks


November 04, 2004
Walter schrieb am Donnerstag, 4. November 2004 05:04:
>
> super.classinfo.name should work.
>
code:
# import std.stdio;
# class Foo : Object{
#        static this(){
#                writef(super.classinfo.name,"\n");
#        }
#}

test2 '_staticCtor'
a.d(4): 'super' is only allowed in non-static member functions
a.d(4): no property 'classinfo' for type 'int'

November 04, 2004
In article <cmchq7$2khf$1@digitaldaemon.com>, Thomas Kuehne says...
>
>Walter schrieb am Donnerstag, 4. November 2004 05:04:
>>
>> super.classinfo.name should work.
>>
>code:
># import std.stdio;
># class Foo : Object{
>#        static this(){
>#                writef(super.classinfo.name,"\n");
>#        }
>#}
>
>test2 '_staticCtor'
>a.d(4): 'super' is only allowed in non-static member functions
>a.d(4): no property 'classinfo' for type 'int'
>
# import std.stdio;
# class Foo : Object{
#        static this(){ Foo.display_name(); }
void display_name() {
#                writef(super.classinfo.name,"\n");
#        }
#}
Internal error: e2ir.c 814


November 04, 2004
"Thomas Kuehne" <thomas-dloop@kuehne.cn> wrote in message news:cmchq7$2khf$1@digitaldaemon.com...
> Walter schrieb am Donnerstag, 4. November 2004 05:04:
> >
> > super.classinfo.name should work.
> >
> code:
> # import std.stdio;
> # class Foo : Object{
> #        static this(){
> #                writef(super.classinfo.name,"\n");
> #        }
> #}
>
> test2 '_staticCtor'
> a.d(4): 'super' is only allowed in non-static member functions
> a.d(4): no property 'classinfo' for type 'int'

Ok, that's right. But try classinfo.base.name.