Newbie: copy, assignment of class instances

Larry Luther larry.luther at dolby.com
Thu May 27 11:48:11 PDT 2010


Thank you, I had no idea that scope was doing this.
I thought that when the docs said that it was being allocated on the stack
that I was getting "struct" like behavior.

"Simen kjaeraas" <simen.kjaras at gmail.com> wrote in message 
news:op.vc0qlpjovxi10f at biotronic-pc.home...
| Larry Luther <larry.luther at dolby.com> wrote:
|
| >
| >   scope B
| >     alpha = new B;
| >
|
| 'scope B alpha;' allocates stack space for a reference to a B, and
| space for an instance of B. If the pointer changes, it is simply no longer
| referencing the instance on the stack.
|
| -- 
| Simen 




More information about the Digitalmars-d-learn mailing list