mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
new translation added
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@178054 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
81da8ee19b
commit
b0a2f11d6b
1 changed files with 32 additions and 32 deletions
|
@ -1,23 +1,22 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
|
||||
<sect1 id="language.oop5.basic">
|
||||
<title>The Basics</title>
|
||||
<title>Základy</title>
|
||||
|
||||
<sect2 id="language.oop5.basic.class">
|
||||
<title>class</title>
|
||||
<para>
|
||||
Every class definition begins with the keyword class, followed by a class
|
||||
name, which can be any name that isn't a <link linkend="reserved">reserved</link>
|
||||
word in PHP. Followed by a pair of curly braces, of
|
||||
which contains the definition of the classes members and methods. Within
|
||||
each method, except for <link linkend="language.oop5.static">static</link>
|
||||
methods, a pseudo variable <varname>$this</varname> is available.
|
||||
<varname>$this</varname> is a reference to the same instance that
|
||||
called the method.
|
||||
Každá definícia triedy začína kľúčovým slovom class nasledované názvom
|
||||
triedy, ktorý je ľubovoľný, s výnimkou
|
||||
<link linkend="reserved">rezervovaných</link> slov v PHP. Nasleduje pár
|
||||
zložených zátvoriek, ktoré obsahujú definíciu vlastností a metód triedy.
|
||||
V každej metóde, okrem <link linkend="language.oop5.static">statických</link>,
|
||||
je dostupná pseudo premenná <varname>$this</varname>. <varname>$this</varname>
|
||||
je referencia na tú istú inštanciu, z ktorej bola metóda volaná.
|
||||
</para>
|
||||
<example>
|
||||
<title>Simple Class definition</title>
|
||||
<title>Jednoduchá definícia triedy</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -40,14 +39,14 @@ class SimpleClass
|
|||
<sect2 id="language.oop5.basic.new">
|
||||
<title>new</title>
|
||||
<para>
|
||||
To create an instance of an object, a new object must be created and
|
||||
assigned to a variable. An object will always be assigned when
|
||||
creating a new object unless the object has a
|
||||
<link linkend="language.oop5.decon">constructor</link> defined that throws an
|
||||
<link linkend="language.exceptions">exception</link> on error.
|
||||
Na vytvorenie inštancie objektu, musí byť vytvorený nový objekt a priradený
|
||||
premennej. Ak sa vytvára nový objekt, vždy je priradený premennej, s jedinou
|
||||
výnimkou, a to ak objekt obsahuje <link linkend="language.oop5.decon">konštruktor</link>,
|
||||
v ktorom je definovaná <link linkend="language.exceptions">výnimka</link>,
|
||||
vracajúca chybu.
|
||||
</para>
|
||||
<example>
|
||||
<title>Creating an instance</title>
|
||||
<title>Vytváranie inštancie</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -57,14 +56,14 @@ $instance = new SimpleClass()
|
|||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
When assigning an already created instance of an object to a new variable, the new variable
|
||||
will access the same instance as the object that was assigned. This
|
||||
behaviour is the same when passing instances to a function. A new instance
|
||||
of an already created object can be made by
|
||||
<link linkend="language.oop5.cloning">cloning</link> it.
|
||||
Ak priraďujeme už existujúcu inštanciu objektu novej premennej, tak nová
|
||||
premenná bude pristupovať k tej istej inštancii ako premenná, ktorej bol
|
||||
pôvodný objekt priradený. Toto isté správanie je aj pri predávaní inštancie
|
||||
ako parametru funkcii. Nová inštancia už existujúceho objektu može byť
|
||||
vytvorená <link linkend="language.oop5.cloning">klonovaním</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Object Assignment</title>
|
||||
<title>Priraďovanie objektu</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -98,19 +97,20 @@ object(SimpleClass)#1 (1) {
|
|||
<sect2 id="language.oop5.basic.extends">
|
||||
<title>extends</title>
|
||||
<para>
|
||||
A class can inherit methods and members of another class by using the
|
||||
extends keyword in the declaration. It is not possible to extend multiple
|
||||
classes, a class can only inherit one base class.
|
||||
Trieda môže zdediť metódy a vlastnosti inej triedy použitím kľúčového
|
||||
slova extends v deklarácii. Nie je možné dedenie z viacerých tried, trieda
|
||||
môže dediť iba z jednej základnej triedy.
|
||||
</para>
|
||||
<para>
|
||||
The inherited methods and members can be overrided, unless the parent
|
||||
class has defined a method as <link linkend="language.oop5.final">final</link>,
|
||||
by redeclaring them within the same name defined in the parent class.
|
||||
It is possible to access the overrided method or members by
|
||||
referencing them with <link linkend="language.oop5.paamayim-nekudotayim">parent::</link>
|
||||
Zdedené metódy a vlastnosti môžu byť nahradené, s jednou výnimkou, a to, ak
|
||||
je v rodičovskej triede definovaná metóda ako <link linkend="language.oop5.final">final</link>,
|
||||
opakovanou deklaráciou s tým istým menom metódy, aké bolo použité v
|
||||
rodičovskej triede.
|
||||
Je taktiež možné pristupovať k nahradeným metódam alebo vlastnostiam rodičovskej
|
||||
triedy, odkazovaním sa pomocou <link linkend="language.oop5.paamayim-nekudotayim">parent::</link>
|
||||
</para>
|
||||
<example>
|
||||
<title>Simple Class Inherintance</title>
|
||||
<title>Jednoduché dedenie triedy</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
|
Loading…
Reference in a new issue