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.

 

相关文章: