
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
Are you referring to their standard library? )
No, I mean that in MQL you can't declare an abstract virtual method without implementation. In MQL, virtual methods of a base class must always have an implementation, which is fraught with the problems you mentioned.
There are not many basic basic interfaces in C#
Actually there are a lot.
It's not all bad, in my opinion. There are not so many basic main interfaces in C#, in my opinion (I'm not a C# specialist), that you can't reduce their methods to one basic superclass and then inherit what you need.
P.S. To implement something multiple through constructions like <<<<>>>> is a bit of a pain in the ass. Better to do functions through operators, e.g. a==b calls a.compareto( b ), a[comparer]==b calls comparer.compare(a,b) etc.Imho, it would be a terrible mishmash.
+ Calling virtual methods is not free.No, I mean that in MQL you can't declare an abstract virtual method without implementation. In MQL, virtual methods of a base class must always have an implementation, which is fraught with the problems you mentioned.
I'm not sure why you can't declare it without implementation? Abstract class methods have been supported in MQL for years.
1. In fact, there are a lot of them.
2. imho, it would be a terrible mishmash.
+ Call of virtual methods is not free.1. I'll know.
2. Let's see what happens, if I manage to get what I'm doing now right, I'll post it on the forum).
Not for free, yes. Any universal OOP solution turns out to be expensive, but if your purpose is to easily and beautifully build simple Expert Advisors and indicators (without special features), then it is worth it, imho.
I don't really understand why you can't declare without implementation? Abstract class methods have been supported in MQL for years.
Because an entry like this will cause a compilation error:
Because an entry like this will cause a compile-time error:
And the person thought it's impossible to declare such a method in MQL at all, as far as I understood from his post.
Few people know (even fewer know and use), but pure-virtualfunctions can have a body
They also have to be overloaded in the descendant class
Few people know (even fewer know and use), but purely virtualfunctions can have a body
They also have to be overloaded in the descendant class
So interfaces can still have their own method code? Can it be called somehow? )
Just came across this recently...
p.s. I tried it now though... Even if A::f2() has no body, the compiler does not react to such a call. I.e. I have to catch an error later in the runtime. No way.
Hmm, interesting feature... I guess it's a default method, just to be called in descendants of A::f2().
Tested it - you're right in general =)
p.s. Although, I've tried it now... Even if A::f2() has no body, the compiler reacts nothing to such a call.
Apparently it's a cockroach after all...