super
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Fjala super i referohet klasës prind. Me super(...) thërret konstruktorin e prindit, dhe me super.metoda() përdor versionin e prindit të një metode që e ke ndryshuar.
EnglishEN
The super keyword refers to the parent class. With super(...) you call the parent's constructor, and with super.method() you use the parent's version of a method you've changed.
Si ta mendosh
Si kur thua „siç e bënte gjyshja“: e përdor recetën origjinale të prindit, pastaj i shton diçka tënden.
Lexoje në anglisht
Like saying “the way grandma made it”: you use the parent's original recipe, then add your own twist.
Shembull kodijava
class Portier extends Lojtar {
Portier(String emri) {
super(emri); // thërret konstruktorin e Lojtar
}
}