We are expanding our initializing sequences "{ ... }". In the next build we'll allow to use any expression, not only constant.
In place of this change, there will be a restriction on using constants for enumerations (as for an ordinary expression): if the constant does not belong to the enum, the corresponding error will be produced.
Analysis of existing codes has shown that the single zero sequence "{0}" is often used incorrectly.
For example, like this:
MqlTradeRequest request={0};
Such a notation means to set the value of zero for the first field of the structure and zero out the rest of the fields.
For the above code line, according to the new rules, there will be an error since the first field has the type ENUM_TRADE_REQUEST_ACTIONS, an enumeration that lacks the value "0".
cannot convert 0 to enum 'ENUM_TRADE_REQUEST_ACTIONS'
The Test_Nasledovania : public CObject class itself is an heir of the CObject base class of the entire standard library.)
In addition to connecting the trading class, you also need to create an object of the trading class, and then refer to the methods of the class through the created object
***
#include <Trade\Trade.mqh>
//---
CTrade m_trade; // object of CTrade class
***
voidOnTick()
{
m_trade.Buy(***
}
In addition to connecting a trading class, you also need to create an object of this trading class and then refer to the methods of the class through the created object
The question about using class methods in Expert Advisors and scripts is of course, the creation of objects. But the question is about using methods of a base class, in a descendant class. Why do we need to create objects there?
About using methods of classes, in Expert Advisors and scripts, it goes without saying that we create objects. But the question is about using methods of a base class, inside a descendant class. Why do you need to create objects there?
What class should I inherit my class from, so that I can use methods of all these classes inside my class without creating objects? If it's possible at all)))
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
After upgrading to version 2981, an error has started to appear in the line
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5, tips and tricks
Ilyas, 2021.05.28 18:18
We are expanding our initializing sequences "{ ... }". In the next build we'll allow to use any expression, not only constant.
In place of this change, there will be a restriction on using constants for enumerations (as for an ordinary expression): if the constant does not belong to the enum, the corresponding error will be produced.
Analysis of existing codes has shown that the single zero sequence "{0}" is often used incorrectly.
For example, like this:
Such a notation means to set the value of zero for the first field of the structure and zero out the rest of the fields.
For the above code line, according to the new rules, there will be an error since the first field has the type ENUM_TRADE_REQUEST_ACTIONS, an enumeration that lacks the value "0".
The correct way would be:
MqlTradeRequest request={};So I'm writing -- which class should I inherit my class from to use these methods from their standard library?
What's wrong with my question? ))))
Here's the code, what's wrong?
The class includes
The class Test_Nasledovania : public CObject itself is an heir of the base class CObject of the whole standard library.)
Here's the code, what's wrong?
The class includes
The Test_Nasledovania : public CObject class itself is an heir of the CObject base class of the entire standard library.)
In addition to connecting the trading class, you also need to create an object of the trading class, and then refer to the methods of the class through the created object
What's wrong with my question? ))))
Because the help has the whole inheritance of all these classes written in black and white.
In addition to connecting a trading class, you also need to create an object of this trading class and then refer to the methods of the class through the created object
The question about using class methods in Expert Advisors and scripts is of course, the creation of objects. But the question is about using methods of a base class, in a descendant class. Why do we need to create objects there?
About using methods of classes, in Expert Advisors and scripts, it goes without saying that we create objects. But the question is about using methods of a base class, inside a descendant class. Why do you need to create objects there?
You have inherited your class from CObject:
Excuse me, but what methods were you expecting to see?
Here is an example of using methods of a base class inside an inherited class without using an object
I want to use so all the methods included in
What class should I inherit my class from, so that I can use methods of all these classes inside my class without creating objects? If it's possible at all)))
You inherited your class from CObject:
Sorry, what methods were you expecting to see?
I agree))), I was stupid))), the base class of all these methods, does not allow to use methods of classes of its descendants)))