C++ objects behave upon assignment
Hello,
I am trying to understand how C++ object behave in the following case.
I declare a handle using windows HDC as follows: HDC myHDC.
version 1:
My function is delcared as follows:
Code:
BMManager::BMManager(HDC _hdc) {
myHDC=_hdc;
}
version 2:
Code:
BMManager::BMManager(HDC &_hdc) {
myHDC=&_hdc;
}
In both version, the declaration for myHDC remains the same. The compiler did not complain on any error.
Question1: Why would myHDC by treated differently between version 1 and version 2? After all, upon assignment the object declared remains the same.
I would assume that version 1 says that is copy assignment, so all values in HDC is copyied. Perhaps handles are not object?????
In version 2, myHDC points to an address of _hdc????