OOP - Interface

To add comments, please log in or register
Ex Ovo Omnia
3357
Ex Ovo Omnia  

I learned that MQL5 implemented the interface keyword.

Could someone bring me some insight how it could be helpful? I did not find any use of it, it seemed more like a limited abstract class than the interface (as known in Java).

whroeder1
17943
whroeder1  
Language Basics / Data Types / Structures, Classes and Interfaces - Reference on algorithmic/automated trading language for MetaTrader 5
An interface allows determining specific functionality, which a class can then implement. 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.
Exactly a limited abstract class, syntactic sugar.  No need for Abstract Classes and Pure Virtual Functions, implicitly pure virtual functions.
Ex Ovo Omnia
3357
Ex Ovo Omnia  
Thanks, so I can forget it.
Amir Yacoby
1218
Amir Yacoby  
Ovo Cz:

I learned that MQL5 implemented the interface keyword.

Could someone bring me some insight how it could be helpful? I did not find any use of it, it seemed more like a limited abstract class than the interface (as known in Java).

If metaquotes will add the possibility of a class to inherit a class and at the same time implement an interface it will be useful.

Without it, it's a half way.
Ex Ovo Omnia
3357
Ex Ovo Omnia  
Amir Yacoby:
If metaquotes will add the possibility of a class to inherit a class and at the same time implement an interface it will be useful.

Without it, it's a half way.
Yes, this is the (only) way the interface can be used.
Amir Yacoby
1218
Amir Yacoby  
Ovo Cz:
Yes, this is the (only) way the interface can be used.
Just recieved an update from metaquotes saying it will be allowed to do so.
Ex Ovo Omnia
3357
Ex Ovo Omnia  
Amir Yacoby:
Just recieved an update from metaquotes saying it will be allowed to do so.

Probably, though I am afraid it won't happen this life.
Marco vd Heijden
Moderator
8156
Marco vd Heijden  

It's actually problematic‌ and easier to achieve taking the regular route.

Ex Ovo Omnia
3357
Ex Ovo Omnia  
Marco vd Heijden:

It's actually problematic‌ and easier to achieve taking the regular route.


Are you talking about implementation or about coding?‌ As for coding, the only workaround I have been using are wrappers. So instead of adding a single method, I need to define a new class.

Marco vd Heijden
Moderator
8156
Marco vd Heijden  

I created one item and tried to replicate it multiple times which was dramatic so i ended up writing the entire thing in classical terms which worked fine.

The problem was in the (string) identifiers they got mixed up maybe i will find a solution in the future but for now i tend to stay away.‌

Ex Ovo Omnia
3357
Ex Ovo Omnia  
Marco vd Heijden:

I created one item and tried to replicate it multiple times which was dramatic so i ended up writing the entire thing in classical terms which worked fine.

The problem was in the (string) identifiers they got mixed up maybe i will find a solution in the future but for now i tend to stay away.‌

To be honest, I cannot figure out what you are describing.
12
To add comments, please log in or register