Deprecated behavior, hidden method calling will be disabled in a future MQL compiler version - page 3

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
I'm sorry, but I don't think we understand each other. There is no problem with ambiguous code in the sample code. The problem is not with the Name(const string name) method that I declared in the derived class, but the problem is with the Name(void) method of the parent class, which is not declared in the derived class at all.
Yes, you are right, the compiler warning does refer to the line where Name(void) is called, which you did not redeclare.
It's not my conclusion, a function with same name in inner scope as the one in outer scope - the inner one hides the outer one.
This is c++ and also MQL5.
The reason of the warning:
is that there is an ambigiuity in hiding (not overriding) which is implicitly allowed in current MQL5 version which will not be allowed in future versions.
The problem is that CSymbolInfo has 2 Name() methods, one with parameters and one parameterless.
By redefining Name() in your derived class CSymInfo with a specific parameter ( const string name ), you've hidden the parameterless version of Name() from the base class. This is what triggers the compiler warning.
Well if you read the thread carefully you'll see that that was my point all the way
But the problem here is with what you call shadowing or hiding of the methodsThere is no overload across scope as you know. When you do that, and the base is not virtual, than it's called hiding.
Well if you read the thread carefully you'll see that that was my point all the way
But the problem here is with what you call shadowing or hiding of the methodshttps://www.mql5.com/en/forum/479024#comment_55528034
Because one post prior to that there was another question asked which I was referring
The message itself is saying that it is about hiding.. read the message
Edit: right, and hiding happens across scope when there is no override (because for instance the base method is not virtual).Thanks for the link. So far I haven't really understood how it relates to my question, but I'll keep trying :-)
Just to be sure, I'll repeat my conclusion and I'll be glad for confirmation, or for a demonstration of how this problem can be bypassed.
If there are 10 overloaded methods in the parent class and I want to override the behavior of only one of them in the derived class, I still have to declare all 10 in the derived class.
The message itself is saying that it is about hiding.. read the message
Edit: right, and hiding happens across scope when there is no override (because for instance the base method is not virtual).So, here is a real world "sample-code", that will give you a full usage of all working versions of overloading, overriding and inheritance that MQL5 supports. - MQL5 is limited in its inheritance, as it does not support merging.
I guess, you will need a while to figure this out.
EDIT: The uploaded file as a typo in line 662: it should have been const, not cosnt...