当前位置: 代码迷 >> 综合 >> Cannot reduce the visibility of the inherited method from Interface解决办法
  详细解决方案

Cannot reduce the visibility of the inherited method from Interface解决办法

热度:79   发布时间:2023-10-08 20:29:31.0

报错:Cannot reduce the visibility of the inherited method from Interface

原因:子类方法的访问权限低于基类该方法的访问权限。

解决办法:调整子类方法的访问权限大于或等于基类的访问权限。

解释:如果允许子类方法降低父类方法的权限,当通过父类引用调用子类方法时,将掩盖掉该错误(子类方法访问权限较低)。这种思想将引起大量错误的出现。

  相关解决方案