Good evening,
I have this
unit sample
interface
type
IIntf = interface
['{00000000-0000-0000-0000-000000000000}']
function MakeSomething(inputValue: Integer): Integer;
end;
TImpl = class(TInterfacedObject, IIntf)
// Implementation of IIntf
function MakeSomething(inputValue: Integer): Integer;
// Other methods
function MakeSomethingElse(inputValue: Integer): Integer;
end;
implementation
procedure TImpl.MakeSomething(inputValue: Integer): Integer;
begin
Result := inputValue + 1;
end;
procedure TImpl.MakeSomethingElse(inputValue: Integer): Integer;
begin
Result := inputValue + 2;
end;
end.
Then I have a situation in which I need a generic map <string, IIntf>, because I need using clients not to see the extra methods available on the implementations of IIntf.
Reading the documentation I understand that in this case I must use a TFPGMapInterfacedObjectData (because I am dealing with refcounted material) not a TFPGMap. Is this correct?
Then I also have another situation in which I need a generic map <string, TImpl>, because I need using clients to see all methods available on TImpl.
In this case should I use a TFPGMap<string, TImpl> or should I use a TFPGMapInterfacedObjectData<string, TImpl>?
The point is: is TFPGMapInterfacedObjectData necessary everytime we are using TInterfacedObject as a base class? or does it depend on what we put in the data part of the map?
Thanks