[php] Interface abstract里面的私有方法 private method of interface and abstract class

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.

原文地址:https://www.cnblogs.com/davidhhuan/p/1750108.html