Reintroduce/fi
Deutsch · English · Esperanto · Français · Suomi
Määritettä (modifier) reintroduce käytetään olio-ohjelmoinnissa. Määrite reintroduce mahdollistaa vanhemman (kanta) luokan metodin piilottamisen uudella metodilla, jolla on sama nimi. Toisin sanoen luokassa on nyt uusi metodi, joka on peräisin tästä luokassa. Vanhemman luokan metodi säilyy ja sitä voi silti käyttää.
Kantaluokan metodia ei enää ole olemassa uudessa luokassa, vaan se on korvattu uudella metodilla, jolla on sama nimi. Metodi säilyy alkuperäisessä muodossa vanhemmassa luokassa ja sitä voidaan käyttää vanhemman luokan kautta.
Esimerkki:
interface
type
TParentClass = class
procedure SetTest(intNum: Integer); // Jokin metodi
end;
TDerivedClass = class(TParentClass)
procedure SetTest(strName: String); reintroduce; // Tämä korvaa vanhemman luokan metodin.
end;
implementation
procedure TDerivedClass.SetTest(strName: String);
begin
inherited SetTest(1); // kutsutaan samalla nimellä vanhemman luokan metodia tarvittaessa
end;From the Free Pascal wiki, page "Reintroduce/fi", as it stood on 2019-11-10 after a change by Djzepi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Edited on wiki.freepascal.org by 2 people, 2018–2019
From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.
| When | Who | What changed |
|---|---|---|
| Djzepi | Created page | |
| Mathias | (minor) | |
| Djzepi |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
