Hello,

Can anybody tell me how can I know which specific type an instance of
class is? The "is" operator seems weird when interface is used.

Suppose TMyInterface is a interface, and classes TCircle and TSquar
both implements TMyInterface, and inst:TMyInterface, inst :=
TCircle.Create. How can I know which instance is inst? The following
code can not even compile:

if inst is TCircle then ...

class type expected, but got "TMyInterface"
Incompatible type for arg no. 2: Got "TMyInterface", expected "TObject"

Thanks

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to