mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Class names start with an uppercased letters...
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@55567 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
7c883cf34c
commit
115607076a
1 changed files with 21 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.24 $ -->
|
||||
<!-- $Revision: 1.25 $ -->
|
||||
<chapter id="language.oop">
|
||||
<title>Classes and Objects</title>
|
||||
|
||||
|
@ -504,7 +504,7 @@ $b->example();
|
|||
<para>
|
||||
You may find yourself writing code that refers to
|
||||
variables and functions in base classes. This is
|
||||
particularly &true; if your derived class is a refinement
|
||||
particularly true if your derived class is a refinement
|
||||
or specialisation of code in your base class.
|
||||
</para>
|
||||
|
||||
|
@ -534,7 +534,7 @@ class B extends A
|
|||
{
|
||||
function example()
|
||||
{
|
||||
echo "I am B::example and provide additional functionality().<br>\n";
|
||||
echo "I am B::example() and provide additional functionality.<br>\n";
|
||||
parent::example();
|
||||
}
|
||||
}
|
||||
|
@ -617,9 +617,9 @@ page2.php:
|
|||
include("classa.inc");
|
||||
|
||||
$s = implode("", @file("store"));
|
||||
unserialize($s);
|
||||
$a = unserialize($s);
|
||||
|
||||
// now use the function show_one of the $a object.
|
||||
// now use the function show_one() of the $a object.
|
||||
$a->show_one();
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -695,9 +695,9 @@ page2.php:
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
|
||||
class foo
|
||||
class Foo
|
||||
{
|
||||
function foo($name)
|
||||
function Foo($name)
|
||||
{
|
||||
// create a reference inside the global array $globalref
|
||||
global $globalref;
|
||||
|
@ -732,7 +732,7 @@ class foo
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
|
||||
$bar1 = new foo('set in constructor');
|
||||
$bar1 = new Foo('set in constructor');
|
||||
$bar1->echoName();
|
||||
$globalref[0]->echoName();
|
||||
|
||||
|
@ -806,18 +806,18 @@ set from outside */
|
|||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
class a
|
||||
class A
|
||||
{
|
||||
function a($i)
|
||||
function A($i)
|
||||
{
|
||||
$this->value = $i;
|
||||
// try to figure out why we do not need a reference here
|
||||
$this->b = new b($this);
|
||||
$this->b = new B($this);
|
||||
}
|
||||
|
||||
function createRef()
|
||||
{
|
||||
$this->c = new b($this);
|
||||
$this->c = new B($this);
|
||||
}
|
||||
|
||||
function echoValue()
|
||||
|
@ -827,9 +827,9 @@ class a
|
|||
}
|
||||
|
||||
|
||||
class b
|
||||
class B
|
||||
{
|
||||
function b(&$a)
|
||||
function B(&$a)
|
||||
{
|
||||
$this->a = &$a;
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ class b
|
|||
|
||||
// try to undestand why using a simple copy here would yield
|
||||
// in an undesired result in the *-marked line
|
||||
$a =& new a(10);
|
||||
$a =& new A(10);
|
||||
$a->createRef();
|
||||
|
||||
$a->echoValue();
|
||||
|
@ -857,12 +857,12 @@ $a->c->echoValue();
|
|||
|
||||
/*
|
||||
output:
|
||||
class a: 10
|
||||
class b: 10
|
||||
class b: 10
|
||||
class a: 11
|
||||
class b: 11
|
||||
class b: 11
|
||||
class A: 10
|
||||
class B: 10
|
||||
class B: 10
|
||||
class A: 11
|
||||
class B: 11
|
||||
class B: 11
|
||||
*/
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
|
Loading…
Reference in a new issue