Download MetaTrader 5

struct member undefined error

To add comments, please log in or register
HarriMQL5
352
HarriMQL5  

I get this error on the following code:


class ConstantBar : public CObject
{
    private:

            ConstantBar(int pCBType, int pRange, int pArraySize, double pStartAt) : nPoint(1) {
                ... 
            };
        
            ConstantBar(int pCBType, int pRange, int pArraySize, double pStartAt, double pRetracement) 
                : ConstantBar(pCBType, Range, pArraySize, pStartAt), nPoint(1)
            {
                ...
            };
}

What am I doing wrong?

whroeder1
16353
whroeder1  
Where in the class do you define the data member nPoint?
HarriMQL5
352
HarriMQL5  
whroeder1:
Where in the class do you define the data member nPoint?
Under the private label, it wasnt included in the code snippet, sorry
whroeder1
16353
whroeder1  
You can't call another constructor either.
Ex Ovo Omnia
3382
Ex Ovo Omnia  
Are the constructors private? If so, do you use any static method to create the instances?
HarriMQL5
352
HarriMQL5  
Ex Ovo Omnia:
Are the constructors private? If so, do you use any static method to create the instances?
No, they are not private
Stanislav Korotky
22533
Stanislav Korotky  
You can not call one constructor from the other. If you need some common initilization stuff, move it in a private method and then call it from both constructors.
To add comments, please log in or register