digitalmars.D - Classinfo of a base class.
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= Nov 03 2004
- "Walter" <newshound digitalmars.com> Nov 03 2004
- Thomas Kuehne <thomas-dloop kuehne.cn> Nov 03 2004
- larrycowan <larrycowan_member pathlink.com> Nov 04 2004
- "Walter" <newshound digitalmars.com> Nov 04 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
Nov 03 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
Nov 03 2004
Walter schrieb am Donnerstag, 4. November 2004 05:04:super.classinfo.name should work.
# 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'
Nov 03 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.
# 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'
# class Foo : Object{ # static this(){ Foo.display_name(); } void display_name() { # writef(super.classinfo.name,"\n"); # } #} Internal error: e2ir.c 814
Nov 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.
# 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.
Nov 04 2004









larrycowan <larrycowan_member pathlink.com> 