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.