Home > Ax Technical > Using SysDictClass::as

Using SysDictClass::as

September 20, 2006 Leave a comment Go to comments

<![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…..
 

]]>

Advertisements
  1. (sin nombre) wrote:
    October 4, 2006 at 7:56 pm

    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 😉

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: