import std.stdio; class A { this(T)(T t) { } void write() { T _this = cast(T) this; writeln(this.v); } } class B : A { string v = "hello"; } void main() { auto b = new B; writeln(b.write()); // print hello }