Polymorphism is not the same as method overloading or method overriding. Polymorphism is only concerned with the application of specific implementations to an interface or a more generic base class. Method overloading refers to methods that have the same name but different signatures inside the same class. Method overriding is where a subclass replaces the implementation of one or more of its parent's methods. Neither method overloading nor method overriding are by themselves implementations of polymorphism.
polymorphism in the context of object-oriented programming, is the ability of one type, A, to appear as and be used like another type, B.
So, basically, any RunBaseBatch extension class (the ones you use to process stuff in AX) is an example of polymorphism in AX. Because they all call the methods of the base class as if they were their own.
method overloading is not suppoorted in X++.
Instead, we define methods with different names and a specific argument set:
newFromInventTable(InventTable _it)
newFromPurchLine(PurchLine _pl)
newFromSalesLine(SalesLne _sl)
No comments:
Post a Comment