import std.stdio;
class Line {
public:
void setLength( double len ) {
length = len;
}
double getLength() {
return length;
}
this() {
writeln("Object is being created");
}
private:
double length;
}
void main( ) {
Line line = new Line();
// set line length
line.setLength(6.0);
writeln("Length of line : " , line.getLength());
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266053.html