How could I get this D code to work similar to this Python code?
So, here is the D code:
import std.stdio;
class Vehicle {
int speed;
void printSpeed() {
writeln(this.speed);
}
}
class Airplane: Vehicle {
int speed = 100;
}
Hmm, is there a specific reason aside from the encapsulation
violation? It seems needlessly complicated. If you have
someone/something that has direct access to your source code,
isn't a getter/setter the least of your concerns? Does the
@property decorator incur a large runtime cost?