Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə223/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   219   220   221   222   223   224   225   226   ...   294
DelphiLanguageGuide

IInterface and Inheritance
An interface, like a class, inherits all of its ancestors' methods. But interfaces, unlike classes, do not implement
methods. What an interface inherits is the obligation to implement methods an obligation that is passed onto any
class supporting the interface.
The declaration of an interface can specify an ancestor interface. If no ancestor is specified, the interface is a direct
descendant of 
IInterface
, which is defined in the 
System
 unit and is the ultimate ancestor of all other interfaces.
On Win32, 
IInterface
 declares three methods: 
QueryInterface

_AddRef
, and 
_Release
. These methods
are not present on the .NET platform, and you do not need to implement them.
Note:
IInterface
 is equivalent to 
IUnknown
. You should generally use 
IInterface
 for platform independent
applications and reserve the use of 
IUnknown
 for specific programs that include Win32 dependencies.
QueryInterface
 provides the means to obtain a reference to the different interfaces that an object supports.
_AddRef
 and 
_Release
 provide lifetime memory management for interface references. The easiest way to
implement these methods is to derive the implementing class from the 
System
 unit's TInterfacedObject. It is also
possible to dispense with any of these methods by implementing it as an empty function; COM objects, however,
must be managed through 
_AddRef
 and 
_Release
.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   219   220   221   222   223   224   225   226   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin