[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.

 

posted @ 2010-06-02 16:43  DavidHHuan  阅读(668)  评论(0编辑  收藏  举报