开发者

What is protected method access level with regard to accessing from another object

I'm passing an object reference to a Util class. I'm attempting to invoke a protected method on the Util class but I getting a compile time error - 开发者_运维百科

The method setPositionChild(Field, int, int) from the type Manager is not visible

To invoke a protected method is it required to be in the implementing class only ? Can I not pass the reference to an external class and invoke the reference from there ?


Protected method can be accessed from subclasses. Make that method public if you want to access from any class. See details here

Also as mentioned by @Sean Patrick Floyd, from classes in the same package!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜