Hi All,
I Did a sample to show how to invoke virtual method.
but I got an error line 20
What did I miss ?
Regards
Med
type
TBaseClass = class
public
procedure SomeMethod; virtual;
end;
procedure TBaseClass.SomeMethod;
begin
// to Invoke descendant's implementation
inherited SomeMethod; <------ Error: identifier idents no member "SomeMethod"
end;
TDescendantClass = class(TBaseClass)
public
procedure SomeMethod; override;
end;
procedure TDescendantClass.SomeMethod;
begin
beep;
// writeLn('descendant's functionality here);
// ...
end;
var
fruit: tbaseclass;
begin
fruit := tbaseClass.Create;
fruit.somemethod;
Writeln('Press Enter to continue.');
Readln;
end.