Posts: 266
Threads: 239
Joined: Apr 2011
which par of an object exhibit its state?
what problem may occure when we copy objects without using deep copy constructor?
Pointers are not accessible for static member funcion?
Posts: 9,583
Threads: 8,089
Joined: Apr 2011
You know very well that an object has some characteristics as well as exhibit behavior. State of an object infect is the current value of its data members (characteristics).
In case of deep copy constructors.......
when an object initialize with an existing object's state, then a memory space is allocated to the newly created object. In order to understand this concept easily, please have a look to the statements given below.
Shallow copy means like a "pass by value" e.g. a = b;
deep copy means like a "pass by reference" e.g. a = &b;
so, as you see in deep copy address is passing. In such a situation, problem is same memory location is pointed by different pointers due to address passing.
"this" pointer can't access the static data members because these are class members rather than object. "this" pointer is related with object rather than class, that's why, unable to access static data members.