MQL4 Overload
Overview
Method overloading in MQL4 enables the definition of two or more methods within the same class that share the same name but differ in their number of parameters. This process is known as method overloading and is a mechanism for realizing polymorphism.
Resolution Rules
When an overloaded method is called, the MQL4 compiler follows a specific search order to find the most suitable function:
1. **Class Methods:** The compiler first searches for an exact match among the methods defined directly within the current class. 2. **Base Class Methods:** If no exact match is found in the current class, the compiler searches through the methods of the base classes, progressing sequentially from the nearest ancestor to the most distant one. 3. **Other Functions:** Finally, if no match is found in the class hierarchy, the compiler searches among other available functions.