Constructors (starstruck noob from C++)

Luke J. West luke at west.me.uk
Thu Jan 20 17:18:48 PST 2011


Hi to all from a total noob.

first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two decades? It's beginning to look that way. Obviously I'm
devouring the 2.0 documentation right now, but have not yet found out
how to create a new instance of an existing class object. What I mean
is, given...

auto a = new A;

how do I, in c++ speak, do the D for...

A  b(a); // or if you prefer...
A* b = new A(a);

I'm sure this must be trivial.

Many many thanks,

Luke


More information about the Digitalmars-d mailing list