Display of methods return values in debug observation

 

Hello everybody,

I was wondering if we could have that again, I think it was available in the past, unfortunately now the debugger just says "expression parse error". So each time I want to display any value from inside a class I have to declare an extra data type variable just to check. It gets very impractical over time. Example:

//+------------------------------------------------------------------+
//| dog class holds dogs height and methods for setting and getting  |
//+------------------------------------------------------------------+
class CDog
  {
private:
   double            m_height;
public:
                     CDog(void): m_height(InpHeight) {};
                    ~CDog(void) {};
   bool              SetHeight(double a_height) {m_height = a_height; return(m_height == a_height);}
   double            GetHeight(void)const {return(m_height);}
  };

input double InpHeight = 0.4;    //The dogs height is 40cm

CDog  shiba;

double height = 0.0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   height = shiba.GetHeight();         // Here you can observe height, but you can't observe shiba.GetHeight(), 
                                       // even hough it has a double return value. It works when I make the property public
                                       // and access it directly like in a structure. Is it deliberately designed that way
                                       // and for what reason?
   
   Print("The dogs height is "+ string(height));
//---
   return(INIT_SUCCEEDED);
  }
 
Tobias Johannes Zimmer:

Hello everybody,

I was wondering if we could have that again, I think it was available in the past, unfortunately now the debugger just says "expression parse error". So each time I want to display any value from inside a class I have to declare an extra data type variable just to check. It gets very impractical over time. Example:

No, I cannot remember a time when you could call functions from watch-list in debugger. - But you can access private member variables from watch list.

add following to your list:

shiba.m_height

and see the value.

 

Oh wow thanks, this is so great. It never occurred to me to do that.