Auto-add static field when inherit // mixins, templates?
Chris Nicholson-Sauls via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Aug 21 23:44:38 PDT 2014
class A
{
string getName(this Klass)()
{
return Klass.stringof;
}
}
class B : A
{}
void main()
{
import std.stdio;
auto a = new A;
auto b = new B;
writeln(a.getName());
writeln(b.getName());
}
##################################################
This is about as close as you're going to get without some
hackery.
More information about the Digitalmars-d-learn
mailing list