scope issue

 

I have a variable in a custom class that I declare a pointer to out of the scope.  Then I reset the pointer in the scope with one variable in the class and that variable loses it's value.  I have an oop background so I thought I would apply some of the new oop features but something isn't right.


Order *o = MostRecentOrder();

//this series has been opened

   
//if(CheckPointer(GetPointer(o)) == POINTER_INVALID || o == NULL)
if(o == NULL || CheckPointer(o) == POINTER_INVALID)
{
   Print("new sig=",signal);
   o = new Order(signal);
   orders.Add(o);//orders is a CList object but I have tried CArray and got the same thing
   o.signal = signal;
   Print("inside o.signal=",o.signal);

}

if(o == NULL)Print("o = null");//this condition isn't triggered

if(o.signal == NULL)Print("o.signal = NULL signal=",signal);//but this one is


//my class


class Order : CObject
{
   private:
      double entry1;

   public:
      void Order(int sig);
      void ~Order();
      double GetEntry1();
      int tickets[3];
      int signal;
      int stage;
      int entryMa;
      bool middleMaInvalid;
      bool leftover;
      int target;
      datetime startTime; 
     
     
};

void Order::~Order(void){}

void Order::Order(int sig)
{
   this.signal = sig;
}

double Order::GetEntry1(void)
{
   if(this.entry1 == 0)
   {
      if(!OrderSelect(this.tickets[0],SELECT_BY_TICKET))return(0);
      this.entry1 = OrderOpenPrice();
   }
   return(entry1);
}

 
bfis108137: and that variable loses it's value.
// o.signal is a int; Don't compare it to NULL, it's not a pointer
if(o.signal == NULL)Print("o.signal = NULL signal=",signal);//but this one is
:
int signal;
:
// No need for "this." inside member functions. Use this only to pass yourself to a function.
this.signal = sig;