diff --git a/language/oop5/basic.xml b/language/oop5/basic.xml index 73f72f787f..aef11a94d1 100644 --- a/language/oop5/basic.xml +++ b/language/oop5/basic.xml @@ -1,23 +1,22 @@ - + - The Basics + Základy class - Every class definition begins with the keyword class, followed by a class - name, which can be any name that isn't a reserved - 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 static - methods, a pseudo variable $this is available. - $this 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 + rezervovaných 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 statických, + je dostupná pseudo premenná $this. $this + je referencia na tú istú inštanciu, z ktorej bola metóda volaná. - Simple Class definition + Jednoduchá definícia triedy new - 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 - constructor defined that throws an - exception 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 konštruktor, + v ktorom je definovaná výnimka, + vracajúca chybu. - Creating an instance + Vytváranie inštancie - 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 - cloning 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á klonovaním. - Object Assignment + Priraďovanie objektu extends - 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. - The inherited methods and members can be overrided, unless the parent - class has defined a method as final, - 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 parent:: + 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 final, + 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 parent:: - Simple Class Inherintance + Jednoduché dedenie triedy