Interface In Pascal

for example usage interface in pascal

TMyInterface = interface
 procedure test;
 end;

for example, i create a interface for my class and i will integrated the my interface in my class

TMyObjectInterface = class(TInterfacedObject, TMyInterface)
 procedure test;
 end;

and create procedure for my object interface

 procedure TMyObjectInterface.test;
 begin
 WriteLn('test');
 end;

for usage

var
 MyInterface: TMyInterface;
begin
 MyInterface := TMyObjectInterface2.Create;
 MyInterface.test; 
end.
Advertisements
This entry was posted in Delphi, Freepascal, Lazarus, Pascal, Pascal.Net and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s