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