I am almost done with migrating my software for .NET environment. Now I am going through all the warnings and cleaning them up. Then, I ran into this problem.
Here is my class:
TColorObj = class
value:double;
thecolor:Color;
Constructor;
method ReadColor(bdr:BinaryReader);
method WriteColor(bdw:BinaryWriter);
method Clone:TColorObj;
method ToString:String; Override; <<<<----this method is raising error.
end;
The error is "Cannot override method with lower access than base method." However, if I remove the key word, Override, it raises a warning message, "ToString" hides a parent method." TColorObj class is not inherited from any base class as you can see.
So, do I make the class TColorObj public?
Any help or hints will be appreciated.
You need to make the ToString
method public in visibility, which is what it is in TObject
. You can't move it from 'public' to a lower visibility in a descendant.
TColorObj = class
value:double;
thecolor:Color;
Constructor;
method ReadColor(bdr:BinaryReader);
method WriteColor(bdw:BinaryWriter);
public
method Clone:TColorObj;
method ToString:String; Override; <<<<----this method is raising error.
end;