Home
> Ax Technical > Using SysDictClass::as
Using SysDictClass::as
<![CDATA[
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…..
]]>
Nice tip 🙂
This is a really interesting blog about Axapta (Dynamics AX).
I will came here frequently to learn more interesting tips 😉
Keep in touch.
Mkz.
———————————
http://www.trucosax.com
A Dynamics AX tricks site in Spanish language 😉