Napis co je: 1. Objekt 2. Trieda 3. Public 4. Private 5. Protected 6. Uzavretos, zapuzdrenie, encapsulation 7. dedicnost(inheritance) 8. Viactvarnost (polymorfizmus) 9. druhy polymorfizmu 10. polymorfizmus -univerzalny-parametricky,inkluzivny 11. Presmerovanie (overriding) 12. Pretypovanie, pretazenie (overloading)
##SVK## Uzavretos, zapuzdrenie, encapsulation -trieda ohranicuje - uzatvara vlasnosti svojich objetov pomocou uzatvorenej mnoziny definovanych operaci -pristup k udajom ojektu danej triedy cez jej metody dedicnost(inheritance) -zdielanie vlasnosti, spravania a vzajomnych vztahov medzi triedami -realacia dedenie medzi triedami x dedi od y x je podtriedou y x ma zdedene vlastnosti a spravanie od Y specificke vlastnosti a spravenie(nezdedeny inkrement) Viactvarnost (polymorfizmus) dozsledky: -rovnaky indentifikator pre rozne funkcie -rovnaky symbol operatora pre rozne operacie -vyber potrebnej prekryvajucej funkcie alebo operatora podla argumentov resp. operandov monomorfizmus jazykov vyhody: moznost typovej kontrly a zistenie nekonrzistencii v case kompilacie -ulahcenie detekcie chyb -zvysenie efektivnosti vykonavania programu -zvysenie strukturovanosti programov Nevyhoda :strata flexibilnosti druhy polymorfizmu: -univerzalny ,manipulacia s nekonecnym poctom typov -Parametricky -navzajom disjunktne typy -funkcia ma implicitny alebo explicitny parameter typu funkcie -urcuje typ argumentu funkcie -parametricke typy sluzia ako sablona pre konkretny typ -inkluzivny, objekt podtriedy moze byt vsade tam, kde sa vyzaduje objekt niektorej z jeho nadtried staticke viazanie dynamicke viazanie
-AD-HOC - manipulacia s konecnym poctom nepribuznych typov -Prekryvanie -Presmerovanie (overriding) - definicia clenskych funkcii s rovnakou signaturou v roznych triedach, ktore su spojene vytahom dedicnosti -Pretypovanie, pretazenie (overloading) - pouzitie toho isteho mena pre rozne clenske funkcie definovane v jednej triede (vyber funkcie podla aktualneho typu parametra) ##ENG## Class Defines abstract characteristics of things (objects) It includes characteristics (attributes, datafields or properties) and behaviours (methods, operations, features) Object One particular version (exemplar) of the class with concrete version of characteristics Constructor is a special method that is called whenever a class is instantiat (created) Another object sends a message that calls a constructor A constructor is the first message an object receives and cannot be called subsequently Establishes initial state of properties for the object instance Constructor has always the same name as class and has no return type public – properties are accessible from outer classes and all derived classes private – properties are accessible only in the class it is defined protected – properties are not accessible from outer classes, but still accessible from derived classes Java defines 4 access levels for class members: -public specifies that the member is visible to all -protected modifier specifies that the member is visible to subclasses and to code in the same package -private modifier specifies that the member is visible only to code in the same class none of these modifiers are used, then the default access level is assumed; that is, the member is visible to all code in the package Composition Method of reuse in which new functionality is obtained by creating an object composed of other objects, The new functionality is obtained by delegating functionality to one of the objects being composed, Sometimes called aggregation or containment, although some authors give special meanings to these terms Aggregation – when one object owns or is responsible for another object and both objects have identical lifetimes or when one object has a collection of objects that can exist on their own
Containment – a special kind of composition in which the contained object is hidden from other objects and access to the contained object is only via the container object