![]() |
#1 |
Участник
|
axStart: If X++ will act like c#
Источник: http://axstart.spaces.live.com/Blog/...C0A0!465.entry
============== For the past couple of months I have worked on a Type Safe interface for Dynamics AX .net connector. I’m quite happy with the current version (0.92). However I run in strange things in our AOT. It is possible to do parameter overloading in X++. Parameter overloading: It works for Boolean and base enum base parameters or return types. So a method with return type Boolean can be overloaded with return type yesno. Base class ABC retunBaseEnum() { return ABC::A; } Derived class ABCModel retunBaseEnum() { return ABCModel::Link; } If we have to convert this to C#, the method of the base class becomes virtual. But the derived method can’t be of type overload. Even virtual new is wrong. According to C# the derived method should be virtual. Optional parameters and inheritance: Consider the following X++ code: Base class void optionalParaMeter(int _a, int _b = 0) { } Derived class void optionalParaMeter(int _a, int _b, int _c = 0) { super(_a,_b); } If we translate this code to c#, we get 2 methods in our base class. Virtal void optionalParaMeter(int _a) and Virtal void optionalParaMeter(int _a, int _b ). This is acceptable code. The next step is the derived method. C# will looks like void optionalParaMeter(int _a, int _b) and void optionalParaMeter(int _a, int _b, int _c). But now we get in trouble as they both need to be of type overload, but void optionalParaMeter(int _a, int _b, int _c) can’t be of type overload because this one does not exist in the base class. So we get a new virtual function and an overload function. I ran in this issue when converting the AOT to C#. ![]() ![]() Источник: http://axstart.spaces.live.com/Blog/...C0A0!465.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|