interface AInf
{
private function hiddenMethod();
}

class MyClass implements AInf
{}

When running the code, we will get to error:

 

 

Fatal error: Access type for interface method AInf::hiddenMethod() must be omitted in XXXX

So, there is no way to define a private in the interface.

 

How about private method in abstract class?

abstract class AAbs
{
private function hiddenMethod(){}
}

class MyClass extends AAbs
{}
It doesn't course a anything of error or waring! But in fact that, there is not useful, because extended class can't see it/them anyway.

 

相关文章:

  • 2021-10-18
  • 2021-06-19
  • 2022-01-08
  • 2022-12-23
  • 2021-07-10
  • 2022-03-03
  • 2021-11-18
  • 2022-01-25
猜你喜欢
  • 2021-11-16
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2022-12-23
相关资源
相似解决方案