Autor Beitrag
tartare
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP SP2, WIN Vista Home Professional
Delphi 7/2009, C#, C++(VS 2005 Express)
BeitragVerfasst: Mi 18.06.08 00:01 
Hallo,

Ich wollte fragen ob es möglich ist, in einer Ableitung einer Klasse, eine ursprüngliche property "umzubennen". Also Zum Beispiel

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Hallo = class
private
public
  property Essen: string read (variable) write (procedure);
end;

Tschau = class(Hallo)
private
public
  property Kauen: string read Essen write Essen; //ist es irgendwie möglich so auf die property Essen in 
                                                 //der Basisklasse Hallo zuzugreifen?? 
                                                 //Oder wie könnte man beim Aufruf von Kauen Essen "ausführen"
end;

Danke im Vorraus...
mfg tartare

_________________
Ich leb in meiner eigenen Welt, aber das is ok, da kennt man mich.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.06.08 00:32 
Moin!

Meinst du sowas?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
THallo = class(TObject)
private
  FEssen: String;
protected
  property Essen: String read FEssen write SetEssen;
end;

TSchau = class(THallo)
private
  function GetKauen: String;
  procedure SetKauen(const Value: String);
public
  property Kauen: String read GetKauen write SetKauen;
end;

implementation

function TSchau.GetKauen: String;
begin
  Result := inherited Essen;
end;

procedure TSchau.SetKauen(const Value: String);
begin
  inherited Essen := Value;
end;
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
tartare Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP SP2, WIN Vista Home Professional
Delphi 7/2009, C#, C++(VS 2005 Express)
BeitragVerfasst: Mi 18.06.08 00:52 
Ja genau das!
Dankeschön!

mfg tartare

_________________
Ich leb in meiner eigenen Welt, aber das is ok, da kennt man mich.
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Mi 18.06.08 09:08 
Wenn "Essen" wie im ersten Posting allerdings public deklariert wird ist es auch in der abgeleiteten Klasse zusätzlich sichtbar.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.06.08 09:53 
Moin!

user profile iconRobert.Wachtel hat folgendes geschrieben:
Wenn "Essen" wie im ersten Posting allerdings public deklariert wird ist es auch in der abgeleiteten Klasse zusätzlich sichtbar.
Er wolle ja konkret "umbenennen" :nixweiss: weil das nicht geht, habe ich protected vorgeschlagen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Mi 18.06.08 10:13 
War ja auch nur 'ne Anmerkung... ;)