I've a base class with a virtual function:
TMyBaseClass = class(TObject)
public
ValueOne : integer;
procedure MyFunction(AValueOne : integer); virtual;
end;
procedure TMyBaseClass.MyFunction(AValueOne : integer);
begin
ValueOne := ValueOne;
end;
A descendant class implements a function with the same name. This function adds a new param and calls its anchestor's function.
TMyDerivedClass = class(TMyBaseClass)
public
ValueTwo : integer;
procedure MyFunction(AValueOne : integer; AValueTwo : integer);
end;
procedure TMyDerivedClass.MyFunction(AValueOne : integer; AValueTwo : integer);
begin
inherited MyFunction(AValueOne);
ValueTwo := ValueTwo;
end;
While compiling, the following warning message is shown: W1010 Method
'MyFunction' hides virtual method of base type 'TMyBaseClass'
I found a solution to the problem reading another question, but I'm wondering about what's causing this warning. Does TMyDerivedClass.MyFunction hides TMyBaseClass.MyFunction even if the two functions have different parameters? If so, why?