|
10.11.2006, 01:36 | #1 |
Участник
|
casperkamal: Using SysDictClass::as
Источник: http://casperkamal.spaces.live.com/B...CD63!164.entry
============== SysDictClass has a function called SysDictClass::as(Object _class, classId _classId), this function serves the purpose of using an object instance only if it extends or implements a specified super class.It can turnout to be very useful when you have cases like you want a particular function to be called only if the object received as argument implements a certain Interface For Example You have an Interface Class "mercedes" which has an interface method like "microcomputer". you want the function microcomputer to be executed only when the object you received has implemented the mercedes interface, in these situation where decision is a runtime based one the above specified function would serve handy Class myClass(Object _car) { Mercedes mercedes = SysDictClass::as(_car, classnum(mercedes)); ; if (mercedes) { mercedes.microcomputer(); } } ............lala lal laaaha..... Источник: http://casperkamal.spaces.live.com/B...CD63!164.entry |
|