web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Implicit casting from super-class to sub-class

Volodymyr Giginiak Profile Picture Volodymyr Giginiak
X++ compiler allows casting from the super-class object to the sub-class. For example, UserConnection class extends Connection class. And you are allowed to write the following code:
UserConnection con = new Connection();
The only consequence of doing such thing is a run-time error thrown if a method that exists only on sub-class will be called for the instantiated object.
In the modern managed languages such implicit casting is not allowed and generates compilation error. So, it is best practice not to use it in AX too.

This was originally posted here.

Comments

*This post is locked for comments