This is a bit complicated.
Consider this simple class:
class Thing1
{
public:
int n;
}
Now we will try the first experiment:
Thing1 A;
A.n = 5;
Thing1 B = A;
B.n = 7;
cout << A.n << " " << B.n << endl;
The result is "5 7". Aand B- two separate independent entities. Changing one does not change the other.
:
Thing1 *p = &A;
p->n = 9;
cout << A.n << " " << p->n << endl;
: "9 9"; p A, A.n p->n - .
:
class Thing2
{
public:
int *p;
};
...
Thing2 A;
A.p = new int(2);
Thing2 B = A;
*(B.p) = 4;
cout << *(A.p) << " " << *(B.p) << endl;
"4 4". B = A , , A B , int. . , (.. ), , , , Matrix , - . .
EDIT: @AlisherKassymov, , Thing A=B; , . , . ( , , , (. 3). , , .)