interesting "protect" behavior# Java - 爪哇娇娃
c*t
1 楼
A post a few days ago mentioned if a parent could access child's
function. I thought that it might be interesting to write a
post on "protect".
Any intro Java programmer will know that, given parent class A,
its child classes can access A's protected functions. People
rarely have to think the other way around:
what about A accessing its child class protected functions?
Turn out that you can in Java, and occasionally it can be useful.
The main advantage is that sometimes it can be used
function. I thought that it might be interesting to write a
post on "protect".
Any intro Java programmer will know that, given parent class A,
its child classes can access A's protected functions. People
rarely have to think the other way around:
what about A accessing its child class protected functions?
Turn out that you can in Java, and occasionally it can be useful.
The main advantage is that sometimes it can be used