AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Overriding Fields in Object..

Ein Thema von Delphi-Lover · begonnen am 5. Jan 2005
Antwort Antwort
Delphi-Lover

Registriert seit: 19. Okt 2004
Ort: Amsterdam
30 Beiträge
 
Delphi 2005 Professional
 
#1

Overriding Fields in Object..

  Alt 5. Jan 2005, 16:38
Hello,

Is it possible to override fields instead of Methods. What I like to do is:

A BaseObject with a field myQuery: TQuery;
In the object I use procedures/functions with the myQuery var to do like : add, insert, active and so.

When I make a new object inherited from BaseObject I like to make myQuery of type TADOQuery (overriding the myQuery) so that I can use the functions and procedures inherited from the BaseObject.

I think it is not possible, but is there a good Object Oriented way to do what I want?

Thanks,

Delphi Lover.

Delphi-Quellcode:
TPortObject = Class(TObject)
 Private
  qryPort : TQuery;
 public
  procedure AllPort;
end;

procedure TPortObject.AllPort;
Begin
 qryPort.SQL.Add('Select * from Port');
 qryPort.Active:=True;
End;


TADOPortObject = Class(TPortObject) //inherited
 Private
  qryPort : TADOQuery;
 public
  constructor Create;
end;

constructor TADOPortObject.Create;
Begin
 qryPort:=TADOQuery.Create;
 qryPort.....
 ....
End;


MainSource:

aPortObject:=TADOPortObject.Create;
aPortObject.AllPort;
...
Rob
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz