You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
That's the fast fix, I am suggesting to think better about the design.
Of course, you are right and I agree with you.
The new behaviour means that the called parent method is hidden by the descendant method. You have to explicitly specify the instance of the called method in order to avoid a warning.
This won´t compile in MT4 so it´s not a good solution, when your code needs to be 100% compatible between both platforms.
This won´t compile in MT4 so it´s not a good solution, when your code needs to be 100% compatible between both platforms.
If you need same-named functions in both classes you have to use this design IMO that can be compiled both in MQL5 and MQL4:
Of course, you are right and I agree with you.
Actually I was wrong, it depends of the situation. The simple fix using scope operator can be the right solution or not.
Example:
The Base class can be used standalone, so the load method with a filename parameter is fine.
In the derived class, I have a load method which is a kind of wrapper on the CBase Load method. However on a derived object I don't want the CBase Load method to be callable as it would lead to logical error, so I used intentionally the "hidden method".
Inside CDerived the simple fix is what is needed, and outside I get the warning, reminding me it's a logical error the call this version of the Load() method.
On other case, a redesign would be needed, all depends of the semantic, which is not obvious with meaningless example using Text() method.