mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Please use 4 (four!) spaces for identation, many, many
WS ONLY FIXES. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@55533 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
65f1991d61
commit
57e995fbd9
1 changed files with 49 additions and 49 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.23 $ -->
|
||||
<!-- $Revision: 1.24 $ -->
|
||||
<chapter id="language.oop">
|
||||
<title>Classes and Objects</title>
|
||||
|
||||
|
@ -310,18 +310,18 @@ $different_cart = new Constructor_Cart("20", 17);
|
|||
<programlisting role="php">
|
||||
class A
|
||||
{
|
||||
function A()
|
||||
{
|
||||
echo "I am the constructor of A.<br>\n";
|
||||
}
|
||||
function A()
|
||||
{
|
||||
echo "I am the constructor of A.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
function C()
|
||||
{
|
||||
echo "I am a regular function.<br>\n";
|
||||
}
|
||||
function C()
|
||||
{
|
||||
echo "I am a regular function.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// no constructor is being called in PHP 3.
|
||||
|
@ -347,24 +347,24 @@ $b = new B;
|
|||
<programlisting role="php">
|
||||
class A
|
||||
{
|
||||
function A()
|
||||
{
|
||||
echo "I am the constructor of A.<br>\n";
|
||||
}
|
||||
|
||||
function B()
|
||||
{
|
||||
echo "I am a regular function named B in class A.<br>\n";
|
||||
echo "I am not a constructor in A.<br>\n";
|
||||
}
|
||||
function A()
|
||||
{
|
||||
echo "I am the constructor of A.<br>\n";
|
||||
}
|
||||
|
||||
function B()
|
||||
{
|
||||
echo "I am a regular function named B in class A.<br>\n";
|
||||
echo "I am not a constructor in A.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
function C()
|
||||
{
|
||||
echo "I am a regular function.<br>\n";
|
||||
}
|
||||
function C()
|
||||
{
|
||||
echo "I am a regular function.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// This will call B() as a constructor.
|
||||
|
@ -433,19 +433,19 @@ $b = new B;
|
|||
<programlisting role="php">
|
||||
class A
|
||||
{
|
||||
function example()
|
||||
{
|
||||
echo "I am the original function A::example().<br>\n";
|
||||
}
|
||||
function example()
|
||||
{
|
||||
echo "I am the original function A::example().<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
function example()
|
||||
{
|
||||
echo "I am the redefined function B::example().<br>\n";
|
||||
A::example();
|
||||
}
|
||||
function example()
|
||||
{
|
||||
echo "I am the redefined function B::example().<br>\n";
|
||||
A::example();
|
||||
}
|
||||
}
|
||||
|
||||
// there is no object of class A.
|
||||
|
@ -524,19 +524,19 @@ $b->example();
|
|||
<programlisting role="php">
|
||||
class A
|
||||
{
|
||||
function example()
|
||||
{
|
||||
echo "I am A::example() and provide basic functionality.<br>\n";
|
||||
}
|
||||
function example()
|
||||
{
|
||||
echo "I am A::example() and provide basic functionality.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
function example()
|
||||
{
|
||||
echo "I am B::example and provide additional functionality().<br>\n";
|
||||
parent::example();
|
||||
}
|
||||
function example()
|
||||
{
|
||||
echo "I am B::example and provide additional functionality().<br>\n";
|
||||
parent::example();
|
||||
}
|
||||
}
|
||||
|
||||
$b = new B;
|
||||
|
@ -594,12 +594,12 @@ $b->example();
|
|||
classa.inc:
|
||||
class A
|
||||
{
|
||||
var $one = 1;
|
||||
var $one = 1;
|
||||
|
||||
function show_one()
|
||||
{
|
||||
echo $this->one;
|
||||
}
|
||||
function show_one()
|
||||
{
|
||||
echo $this->one;
|
||||
}
|
||||
}
|
||||
|
||||
page1.php:
|
||||
|
@ -750,9 +750,9 @@ set in constructor
|
|||
set in constructor
|
||||
set in constructor */
|
||||
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
Apparently there is no difference, but in fact there is a
|
||||
very significant one: <varname>$bar1</varname> and
|
||||
|
|
Loading…
Reference in a new issue