How can this be implemented:
ICloneable_1 = public interface
function Clone: Boolean;
end;
ICloneable_2 = public interface
function Clone: Integer;
end;
TCloneable = class(ICloneable_1, ICloneable_2)
private
function ICloneable_1.Clone: Boolean;
function ICloneable_2.Clone: Integer;
public
end;
The error raised is: (E1) colon ( expected, got period (.) on line function ICloneable_1.Clone: Boolean;
Thanks
mh
(marc hoffman)
May 8, 2020, 12:58pm
2
Hi,
the syntax would be something like this:
TCloneable = class(ICloneable_1, ICloneable_2)
private
method Clone1: Boolean; implements ICloneable_1.Clone;
method Clone2: Integer; implements ICloneable_2.Clone;
Where the local names you pick are arbitrary, as long as the are unique. Please see https://docs.elementscompiler.com/Oxygene/Members/ExplicitInterfaceImplementations/ for the full description.
yours,
marc
Thanks, that is working. Got an issue though with hiding the code from Delphi, any idea on that?
mh
(marc hoffman)
May 8, 2020, 3:57pm
4
Yeah, the problem is that, for Oxygene, code inside $IFDEFS still need to be syntactically valid, because $IFDEFs aren’t just a dump pre-processor, but part of the syntax tree. I’ll log an issue to support Delphi-style interface mappings in undefined code (and maybe also support them in Compatibility mode).
Thanks, logged as bugs://84276
bugs://84276 got closed with status fixed.