CArrayInt type usage

 

Hello. 

How do I use an Array of type CArrayInt as parameters to the method inside CFoo below?

#include <Arrays\ArrayInt.mqh>
//---
class CFoo
{
        CFoo(CArrayInt *foo_ptr){
        int total = foo_ptr.Total();
        for(int i=0; i<total; i++)
        Print(foo_ptr.At(i);
        }
        ~CFoo(void){}
}
//---
void OnStart()
{
        //--- how do I print CArrayInt array inside CFoo here?
        
}


?

 
Nelson Wanyama:

Hello. 

How do I use an Array of type CArrayInt as parameters to a the method inside CFoo below?


?

I've got it thanks. 

#include <Arrays\ArrayInt.mqh>
//---
class CFoo
{
        CFoo(CArrayInt *foo_ptr){
        int total = foo_ptr.Total();
        for(int i=0; i<total; i++)
        Print(foo_ptr.At(i);
        }
        ~CFoo(void){}
}
//---
void OnStart()
{
  //--- how do I print CArrayInt array inside CFoo here?
        //answer
        CArrayInt *m_int = new CArrayInt();
//--- add some values to the array to have something to print out
        int total =5;
        for(int i =0; i<total; i++)
         m_int.At(i) = rand();
//---
        CFoo m_foo(m_int);
//---
        delete m_int;
}