Show: Object Pascal C++
Display Preferences

E2271 Property getters and setters cannot be overloaded (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

A property has specified an overloaded procedure as either its getter or setter.


unit Produce;
interface
  type
    Base = class
    public
      function getter : Integer; overload;
      function getter(a : char) : Integer; overload;
      property Value : Integer read getter;
    end;

implementation
function Base.getter : Integer;
begin getter := 0;
end;

function Base.getter(a : char) : Integer;
begin
end;

end.


The overloaded function getter in the above example will cause this error.


unit Solve;
interface
  type
    Base = class
    public
      function getter : Integer;
      property Value : Integer read getter;
    end;

implementation
function Base.getter : Integer;
begin getter := 0;
end;

end.



The only solution when this problem occurs is to remove the offending overload specifications, as is shown in the above example.

Personal tools
In other languages