ctor with references
Hi, quick question :)
given the sample:
1 2 3 4 5
|
struct A{
Node n;
A(Node& n_) : n(n_){ }
}
|
then the node n initialised will be a copy of the argument n_ or the same node (a reference) ?
Thanks for any consideration
- Atari
'n' will be a copy. It will not be a reference because 'n' was not declared as a reference:
1 2
|
struct A{
Node n; // <- not a reference, so it will be a copy
|
Topic archived. No new replies allowed.