Set array member value inside class function?

 

Hello


Im trying to copy the value of a member of an array to another position in the same array. I get the error:

'=' not allowed for objects with protected members or inheritance


but I dont understand why I get this. Can someone help please?


Code:

class COrderEntry
{
    private:
        #define ORDSZ   100
        int obias;
        int oidx;
        int oidx2;
    
        COrderEntry orderLs[];
        
    public:
         COrderEntry(int pBias = 0);
         void COrderAddOrder(long pTicket, double pOOP);
        ~COrderEntry();
};
//+------------------------------------------------------------------+
void COrderEntry::COrderAddOrder(long pTicket, double pOOP) {
    int arrSz;

    arrSz = ArraySize(orderLs);

    if (arrSz < ORDSZ) {
        ArraySetAsSeries(orderLs, false);
        ArrayResize(orderLs, arrSz + 1);
        ArraySetAsSeries(orderLs, true);
    }
    else
    {
        for (int x=arrSz-1; x>0; x--)
            orderLs[x] = orderLs[x-1];
    }    
    
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
COrderEntry::COrderEntry(int pBias = 0)
{
    obias = pBias;
    oidx = (1-obias)/2; oidx2 = (1+obias)/2;
    ArraySetAsSeries(orderLs, true);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
COrderEntry::~COrderEntry()
{
}
 
Try to create a copy constructor.
 

Ok, I see how that can work.

Also, I found https://www.mql5.com/en/forum/154829 which helped


Thank you!

Reason: