Can one object access the private variable of another object of the same class?
Private means private to the class not object. So 2 objects of teh same class can access each other private data.
My doubt is.. how can an obj access another objects data first place? What does this statement mean?? If teh answer is right can anyoen give an example code for this?? Sorry if its a primitive question. Thank you sirisha
If you worry you cannot work... If you work you need not worry
When you call the method "m" of class "C", you have to supply another instance of "C" as the argument. "m" takes the value of "i" from the other instance of "C", and sets its own variable "i" to that value plus one.