开发者

Can names of private functions inside classes be repeated?

class On开发者_如何学Ce
{
  private function thisfn()
  {}
}
class Two
{
  private function thisfn()
  {}
}

is this legit? By the way, does it matter whether it's a private or public function inside a class?

And also, can I create a new function named thisfn() outside of any class (and make it public)? like:

 function thisfn()
{}


This is legit as long as you don't redeclare the same method name within the same class.

Declaring a function outside the scope of the classes with the same name is also valid.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜