![]() |
AW: Ich vermisse Konstanten erst im Konstruktor initialisieren zu können
Diese beiden (Beispiel-) Units sollten veranschaulichen, was geht, und was nicht
Delphi-Quellcode:
unit BaseClass;
interface type TBaseClass0 = class strict private FStrictPrivate : Integer; private FPrivate : Integer; strict protected FStrictProtected : Integer; protected FProtected : Integer; public FPublic : Integer; procedure DoSomeThing; virtual; end; TBaseClass1 = class( TBaseClass0 ) public procedure DoSomeThing; override; end; procedure DoSomeThing( ABase : TBaseClass0 ); implementation { TBaseClass0 } procedure TBaseClass0.DoSomeThing; begin FStrictPrivate := 0; FPrivate := 0; FStrictProtected := 0; FProtected := 0; FPublic := 0; end; { TBaseClass1 } procedure TBaseClass1.DoSomeThing; begin inherited; // FStrictPrivate := 1; // nicht möglich FPrivate := 1; FStrictProtected := 1; FProtected := 1; FPublic := 1; end; procedure DoSomeThing( ABase : TBaseClass0 ); begin with ABase do begin // FStrictPrivate := 3; // nicht möglich FPrivate := 3; // FStrictProtected := 3; // nicht möglich FProtected := 3; FPublic := 3; end; end; end.
Delphi-Quellcode:
unit BaseClass2;
interface uses BaseClass; type TBaseClass2 = class( TBaseClass0 ) public procedure DoSomeThing; override; end; procedure DoSomeThing( ABase : TBaseClass0 ); implementation { TBaseClass2 } procedure TBaseClass2.DoSomeThing; begin inherited; // FStrictPrivate := 2; // nicht möglich // FPrivate := 2; // nicht möglich FStrictProtected := 2; FProtected := 2; FPublic := 2; end; procedure DoSomeThing( ABase : TBaseClass0 ); begin with ABase do begin // FStrictPrivate := 4; // nicht möglich // FPrivate := 4; // nicht möglich // FStrictProtected := 4; // nicht möglich // FProtected := 4; // nicht möglich FPublic := 4; end; end; end. |
AW: Ich vermisse Konstanten erst im Konstruktor initialisieren zu können
Zitat:
Zitat:
Ich sag ab jetzt nie wieder was. :oops: |
AW: Ich vermisse Konstanten erst im Konstruktor initialisieren zu können
Zitat:
mir war grad so, sorry... 8-) |
AW: Ich vermisse Konstanten erst im Konstruktor initialisieren zu können
hmmm. hmmm..mhmmmhmm...hmmhmfgfds:roll:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:44 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz