Please post next time in D.learn.
In D it is still like in other C like languages:

class A {
public:
    this() { writeln("A CTor"); }
}

A a = new A(); create a new object of type A and print "A CTor"

Because D has no standard copy CTor for classes, you must declare your own:
class A {
public:
    this() { writeln("A CTor"); }
    this(ref const A a) { writeln("A copy CTor"); }
}

which is called with:
A a = new A();
A ac = new A(a); // <- calls copy CTor

Reply via email to