Hello,
If I have child class,the child class inherits all methods from the parent,but how do I use functions from the child class in the parent class? Is that what abstraction is? How do I accomplish it?
My code:
type
cParent = class(TObject)
private
function ParentFunction:byte;
function ChildFunction:byte;virtual;abstract;
end;
type
cChild = class(cParent)
private function ChildFunction:byte;override;
end;
function cChild.ChildFunction:byte;
begin
Exit(20);
end;
function cParent.ParentFunction:byte;
begin
Exit(10);
end;
var
c:cParent;
begin
c:= cParent.Create;
WriteLn(c.ChildFunction);
Readln;
end.
It compiles file,but I get abstraction exception.