posted 21 years ago
okay Tony
i'll try to explain the issue here...
think this way,
1. Parent has two methods, method1 and method2 and method2 is calling method1 which is private
2. this means method2 has a pointer to method1 in Parent
3. child also has method1 BUT here method1 is "private" in Parent hence doesn't get "inherited" to child AND THATS WHY child has two copies of the method1 (one from the parent and one child wrote).
4. this implies that parent's method2 is still pointing to Parent's method1 (as method1 didn get overridden)
BUT if u make method1 public in Parent then child inherits that method and as child also re-defines method1 it "overrides" the method1 and so method2 in Parent will call method1 in child instead of parent.
u get that?
if i try to put it in some dummy real scenario,
1. consider person C and his/her parent P where both of them are business man
2. P offers one service called "deal with government for some matter" (public method) and helds private practices (preparing paper work etc) to complete the public service
3. C decides to offer "preparation of papers" as service (public method) BUT also announces that he CAN "deal with government for some matter" as he can delegate the service to his parent P (and client never knows about that trick). Here, C doesn't know that what P does to perform public service of dealing with goverment (of course the business secret)
4. Now, when client calls C's service that is dealing with the government, C will call P and requests him to do the service
Now, at this step what do we expect? do we expect P to use C's service for preparing paper work and all for performing the "dealing with government"? NO. why? because P might be doing something which "he only knows" and he can't delegate it to C because C's methodology is publicly known...you see...so P still uses "his private" techniques to perform the service rather than asking C to do it...
i don't mean to point to any ethical issues here but i just tried to come up with an example..
regards
maulin