Inherited II |
Smart pascal source code
type
TMyObject = class
public
function getText: String; virtual;
end;
function TMyObject.getText: String;
begin
result := 'We can ';
end;
type
TSecond = class(TMyObject)
public
function getText: String; override;
End;
function TSecond.getText: String;
begin
result := inherited getText + 'do it!';
end;
var o := TSecond.Create;
WriteLn(o.getText);
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
Errors >>>>
Hint: "result" does not match case of declaration ("Result") [line: 9, column: 4]
Hint: "result" does not match case of declaration ("Result") [line: 20, column: 4]
Result >>>>
We can do it!
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}