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