mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
fix the 2nd example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@170466 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
cf05044b8f
commit
864b2ceca4
1 changed files with 13 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<sect1 id="language.oop5.visibility">
|
||||
<title>Visibility</title>
|
||||
<para>
|
||||
|
@ -98,23 +98,23 @@ $obj2->printHello(); // Shows Public, Protected2, not Private
|
|||
class MyClass
|
||||
{
|
||||
// Contructors must be public
|
||||
public __construct() { }
|
||||
public function __construct() { }
|
||||
|
||||
// Declare a public method
|
||||
public MyPublic() { }
|
||||
public function MyPublic() { }
|
||||
|
||||
// Declare a protected method
|
||||
protected MyProtected() { }
|
||||
protected function MyProtected() { }
|
||||
|
||||
// Declare a private method
|
||||
private MyPrivate() { }
|
||||
private function MyPrivate() { }
|
||||
|
||||
// This is public
|
||||
Foo()
|
||||
function Foo()
|
||||
{
|
||||
$this->public();
|
||||
$this->protected();
|
||||
$this->private();
|
||||
$this->MyPublic();
|
||||
$this->MyProtected();
|
||||
$this->MyPrivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,11 +131,11 @@ $myclass->Foo(); // Public, Protected and Private work
|
|||
class MyClass2 extends MyClass
|
||||
{
|
||||
// This is public
|
||||
Foo2()
|
||||
function Foo2()
|
||||
{
|
||||
$this->public();
|
||||
$this->protected();
|
||||
$this->private();
|
||||
$this->MyPublic();
|
||||
$this->MyProtected();
|
||||
$this->MyPrivate(); // Fatal Error
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue