I defined a generic interface and I want to use it in another class. I can't figure out what is wrong with this code:
If DOES_NOT_WORK is not defined then everything works. But when DOES_NOT_WORK is defined then the compiler says:
Why?
Interface class does not have definition ("implementation") part, only declaration.
template <typename T> bool Handle(T &val, IGenericHandler<T> *handler);
only function/method
declaration, no function body / implementation / definition.
This here is wrong, because it has method's definition:
template <typename T> bool Handle(T &val, IGenericHandler<T> *handler) { return false; }
please refer to
https://www.mql5.com/en/docs/basis/types/classes#interface
In
fact, an interface is a class that cannot contain any members, and may not have a constructor and/or a destructor. All methods declared in an
interface are purely virtual, even without an explicit definition.
Thank you @Alain Verleyen! I was hoping it was a compiler bug. However, given I'm just starting with MQL I could not make such a claim.
Thank you @Alain Verleyen! I was hoping it was a compiler bug. However, given I'm just starting with MQL I could not make such a claim.
I can confirm it works in 2460, but it stopped working in 2470.


- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I defined a generic interface and I want to use it in another class. I can't figure out what is wrong with this code:
If DOES_NOT_WORK is not defined then everything works. But when DOES_NOT_WORK is defined then the compiler says:
Why?