mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
More typos and some emphasis added
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@90851 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a8b53688ec
commit
daedddb143
1 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<reference id="ref.objaggregation">
|
||||
<title>Object Aggregation/Composition Functions</title>
|
||||
<titleabbrev>Object Aggregation</titleabbrev>
|
||||
|
@ -15,10 +15,11 @@
|
|||
hierachies and can function as a dynamic alternative to multiple
|
||||
inheritance. There are two ways to perform class (and/or object)
|
||||
composition depending on the relationship between the composed
|
||||
elements: Association and Aggregation.
|
||||
elements: <emphasis>Association</emphasis> and
|
||||
<emphasis>Aggregation</emphasis>.
|
||||
</para>
|
||||
<para>
|
||||
An Association is a composition of independently constructed and
|
||||
An <emphasis>Association</emphasis> is a composition of independently constructed and
|
||||
externally visible parts. When we associate classes or objects, each
|
||||
one keeps a reference to the ones it is associated with. When we
|
||||
associate classes statically, one class will contain a reference to an
|
||||
|
@ -58,7 +59,7 @@ $rep = new Report();
|
|||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
We call also associate instances at runtime by passing a reference in a
|
||||
We can also associate instances at runtime by passing a reference in a
|
||||
constructor (or any othe method), which allow us to dynamically change
|
||||
the association relationship between objects. We will modify the example
|
||||
above to illustrate this point:
|
||||
|
@ -122,7 +123,8 @@ $output = $rep->generateReport();
|
|||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Aggregation, on the other hand, implies encapsulation (hidding) of the
|
||||
<emphasis>Aggregation</emphasis>, on the other hand, implies
|
||||
encapsulation (hidding) of the
|
||||
parts of the composition. We can aggregate classes by using a (static)
|
||||
inner class (PHP does not yet support inner classes), in this case the
|
||||
aggregated class definition is not accessible, except through the class
|
||||
|
@ -401,7 +403,7 @@ method: save
|
|||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
One point that we have not mention above, is that the process of
|
||||
One point that we have not mentioned above, is that the process of
|
||||
aggregation will not override existing properties or methods in the
|
||||
objects. For example, the class <classname>FileStorage</classname> defines a
|
||||
<varname>$data</varname> property, and the class
|
||||
|
|
Loading…
Reference in a new issue