Download MetaTrader 5
To add comments, please log in or register
You can test an application before buying it. Find out how to do that!
Iggy
476
Iggy 2010.07.14 19:45 

Finally trying to look into new MQL5 language.

As far as being onject-oriented it's like going back in time about maybe 20 years back.

 But on the more concrete note: Right away I am stumped... What's wrong here?

 

class testclass
{};
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
 testclass newobj = new testclass;
}

'TestObject.mq5' TestObject.mq5 1 1
'new' - type mismatch TestObject.mq5 18 21
illegal operation use  1 1
2 error(s), 0 warning(s)  1 1
 

tektronic
137
tektronic 2010.07.14 20:44  

correct should be

testclass * newobj = new testclass();

... 

delete newobject; 

 

Samuel Olowoyo
2236
Samuel Olowoyo 2010.07.15 16:22  
irusoh1:

Finally trying to look into new MQL5 language.

As far as being onject-oriented it's like going back in time about maybe 20 years back.

 But on the more concrete note: Right away I am stumped... What's wrong here?

 

class testclass
{};
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
 testclass newobj = new testclass;
}

'TestObject.mq5' TestObject.mq5 1 1
'new' - type mismatch TestObject.mq5 18 21
illegal operation use  1 1
2 error(s), 0 warning(s)  1 1
 

You can also learn more by reading the article - Writing an Expert Advisor Using the MQL5 Object-Oriented Programming Approach
/
To add comments, please log in or register