Wednesday, November 10, 2010

Private Data

It possible for one instance of a class to access the private members of another instance of that class.

At first, it might seem like this is strange, but it is done all of the time in copy constructors, and assignment operators. One instance is passed to another instance, which copies the member data, including public, protected, and private member data.

Even a static member function (aka class function) can touch instance data if the instance is passed into it.

No comments:

Post a Comment