--- import std; shared class TimeCount { void startClock() { auto me = cast()this; me.startTime = Clock.currTime; } void endClock() { auto me = cast()this; me.endTime = Clock.currTime; } void calculateDuration() { auto me = cast()this; me.elapsed = me.endTime - me.startTime; }
private: SysTime startTime; SysTime endTime; Duration elapsed; } --- And this is shorter than your unshared member specification.