Why can't my subclass access a protected variable of its superclass, when it's in a different package?

前端 未结 4 1556
梦谈多话
梦谈多话 2020-11-29 05:55

I have an abstract class, relation in package database.relation and a subclass of it, Join, in package database.operations

4条回答
  •  不知归路
    2020-11-29 06:28

    A little known caveat about protected:

    6.6.2 Details on protected Access

    A protected member or constructor of an object may be accessed from outside the package in which it is declared only by code that is responsible for the implementation of that object.

提交回复
热议问题