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ə235/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   231   232   233   234   235   236   237   238   ...   294
DelphiLanguageGuide

Interface Typecasts
An interface-type expression can be cast to Variant. If the interface is of type 
IDispatch
 or a descendant, the
resulting variant has the type code 
varDispatch
. Otherwise, the resulting variant has the type code 
varUnknown
.
A variant whose type code is 
varEmpty

varUnknown
, or 
varDispatch
 can be cast to 
IInterface
. A variant
whose type code is 
varEmpty
 or 
varDispatch
 can be cast to 
IDispatch
.
Interface Querying
You can use the as operator to perform checked interface typecasts. This is known as interface querying, and it
yields an interface-type expression from an object reference or from another interface reference, based on the actual
(runtime) type of the object. An interface query has the form
object as interface
where object is an expression of an interface or variant type or denotes an instance of a class that implements an
interface, and interface is any interface declared with a GUID.
An interface query returns nil if object is nil. Otherwise, it passes the GUID of interface to the 
QueryInterface
method in object, raising an exception unless 
QueryInterface
 returns zero. If 
QueryInterface
 returns zero
(indicating that object's class implements interface), the interface query returns an interface reference to object.
200



Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   231   232   233   234   235   236   237   238   ...   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