您的位置:首页 > 编程语言 > PHP开发

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

2010-06-02 16:43 393 查看
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: