On Thursday, 16 July 2015 at 00:39:29 UTC, H. S. Teoh wrote:
If you want to simulate overriding of class variables, you can use a @property method instead:class Animal { @property string voice() { return "Wah!"; } void speak() { writeln(voice); } } class Dog : Animal { override @property string voice() { return "Whoof!"; } }
Alternatively: class Animal { protected string voice; void speak() { writeln(voice); } } class Dog : Animal { this() { voice = "Whoof!"; } }