![]() |
Overriding Fields in Object..
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; ... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:22 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