0

Hi,
I've just learned that Java's 'protected' access specifier has a different effect than that in C++. So is there a way to make a member of a base class visible to its inheritors but not globally?

Dean

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by deanus
1

I've just learned that Java's 'protected' access specifier has a different effect than that in C++. So is there a way to make a member of a base class visible to its inheritors but not globally?

Assuming by globally you mean "other classes in the same package", then no, there is no way to get around this behaviour. Is there any specific problem arising from this that you are trying to solve?

0

Hmm come to think of it no there are no problems because of this issue, I just thought my assignment would be neater if I could avoid making private functions which I only need to use in sub-classes public.

Anyways thanks for the replies guys, much appreciated :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.