Abstract type: Difference between revisions

 
Line 2,581:
 
Abstract method is a virtual method. You must overload it in a subclass using an override modifier.
 
It is also possible to define an interface and class, implementing this interface:
<syntaxhighlight lang="delphi">
type
IMyInterface = interface
procedure Proc1;
procedure Proc2;
end;
MyClass = class(IMyInterface)
public
procedure Proc1;
begin
Print(1);
end;
procedure Proc2;
begin
Print(2);
end;
end;
 
begin
var a: IMyInterface := new MyClass;
a.Proc1;
a.Proc2;
end.
</syntaxhighlight>
 
=={{header|Perl}}==
76

edits