C#

base & this (C#)

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

base i referohet klasës prind: me : base(emri) thërret konstruktorin e prindit, dhe me base.Metoda() përdor versionin e tij. this i referohet objektit aktual. Është si super në Java.

EnglishEN

base refers to the parent class: : base(name) calls the parent's constructor, and base.Method() uses its version. this refers to the current object. It's like super in Java.

Si ta mendosh

Si kur thua „siç e bënte babai“, pastaj shton diçka tënden.

Lexoje në anglisht

Like saying “the way dad did it”, then adding something of your own.

Shembull kodicsharp

class Portier : Lojtar {
    public Portier(string emri) : base(emri) { }
}

Terma të lidhur