Putting the generic in Generics?
Annoyance 1:
TThing = class
private
FThing: T;
procedure SetThing(const Value: T);
protected
property Thing: T read FThing write SetThing;
public
procedure Configure(const aThing:T = nil); // *
end;
* [dcc32 Error]: E2268 Parameters of this type cannot have default values
Why? It’s a class instance pointer, isn’t it?
Annoyance 2:
Types are simplified.
Unit 1
TAbstractColumn = class end;
TColumn = class(TAbstractItem) end;
TGridHelper = class(TList<TColumn>) end;
Unit 2 (uses 1)
TQueryGridHelper = class(TGridHelper) end;
TQueryStrGridHelper = class(TQueryGridHelper);
TQueryDBGridHelper = class(TQueryGridHelper);
note: TDBAdvGrid is a direct descendent of TAdvStringGrid
Unit 3 (uses 1 and 2)
procedure SomeClass.DefineColumns(const aHelper: ???);
If it is defined as
procedure DefineColumns (const Helper: TQueryStrGridHelper);
I get: [dcc32 Error]: E2010 Incompatible types: ‘TQueryStrGridHelper’ and ‘TQueryDBGridHelper’ – which is understandable, but how can I specify an argument type for DefineColums which can take both a TQueryStrGridHelper and a TQueryDBGridHelper?
You must be logged in to post a comment.