delphi 接口编程_Delphi编程101中的接口

delphi 接口编程

In Delphi, "interface" has two distinct meanings. In OOP jargon, you can think of an interface as a class with no implementation. In Delphi unit definition interface section is used to declare any public sections of code that appear in a unit. This article will explain interfaces from an OOP perspective.

Delphi中 ,“接口”具有两个不同的含义。 在OOP术语中,您可以将接口视为没有实现的类。 在Delphi中,单元定义接口部分用于声明出现在单元中的代码的所有公共部分。 本文将从OOP角度解释接口。

If you are up to creating a rock-solid application in a way that your code is maintainable, reusable, and flexible the OOP nature of Delphi will help you drive the first 70% of your route. Defining interfaces and implementing them will help with the remaining 30%.

如果您打算以一种可维护,可重用和灵活的代码方式创建坚如磐石的应用程序,则Delphi的OOP性质将帮助您实现前70%的路线。 定义接口并实现它们将帮助剩下的30%。

抽象类 ( Abstract Classes )

You can think of an interface as an abstract class with all the implementation stripped out and everything that is not public removed. An abstract class in Delphi is a class that cannot be instantiated—you cannot create an object from a class marked as abstract.

您可以将接口视为一个抽象类,其中删除了所有实现,并删除了所有不公开的内容。 Delphi中的抽象类是无法实例化的类-您不能从标记为抽象的类中创建对象。

Let's take a look at an example interface declaration:

让我们看一下接口声明示例:

type 类型
IConfigChanged =
IConfigChanged = interface['{0D57624C-CDDE-458B-A36C-436
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值