Reduce visibility when implementing interface in Java

后端 未结 4 1348
误落风尘
误落风尘 2021-01-11 18:12

I would like to design class A implements interface C and reduce the visibility of a method (declared in C)to make it secure from outer world, make one of the methods in in

4条回答
  •  孤城傲影
    2021-01-11 18:23

    You cannot reduce visiblity because you could write something along the lines of

    C newC = new A();
    

提交回复
热议问题