Wrong parameters count / Event handling function not found

 

Hello,

I have the following code and when I compile it I'm getting "Wrong parameters count" compilation error but I can't see why. Could some one tell me where I'm going wrong please.

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class Foo
  {
protected:
   int               m_applied_price;
   int               m_timeframe;

public:
                     Foo(const int applied_price, const int timeframe, const int shift);
                    ~Foo() {};
  };

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
Foo::Foo(const int applied_price, const int timeframe, const int shift)
   : m_applied_price(applied_price), m_timeframe(timeframe)
  {
// construct foo
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class Bar : protected Foo
  {
public:
                     Bar(const int applied_price, const int timeframe, const int shift);
                    ~Bar() {};
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
Bar::Bar(const int applied_price, const int timeframe, const int shift)
  {
// construct bar  
   Foo(applied_price,timeframe,shift);
  }

Thanks

 

I've just tried adding a default constructor to Foo and now receiving "Event handling function not found" errors. Still confused! Here's my new code:

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class Foo
  {
protected:
   int               m_applied_price;
   int               m_timeframe;

public:
                     Foo() {};
                     Foo(const int applied_price, const int timeframe, const int shift);
                    ~Foo() {};
  };

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
Foo:: Foo(const int applied_price, const int timeframe, const int shift)
   : m_applied_price(applied_price), m_timeframe(timeframe)
  {
// construct foo
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class Bar : protected Foo
  {
public:
                     Bar(const int applied_price, const int timeframe, const int shift);
                    ~Bar() {};
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
Bar::Bar(const int applied_price, const int timeframe, const int shift)
  {
// construct Bar  
   Foo(applied_price,timeframe,shift);
  }
 
Ok adding void OnInit() {}; fixed the problem. Problem solved.
 
Bar::Bar(const int applied_price, const int timeframe, const int shift) : Foo(applied_price,timeframe,shift)
  {
  }
 
Exactly lippmaje.
Bar::Bar(const int applied_price, const int timeframe, const int shift)
  {
// construct Bar  
   Foo(applied_price,timeframe,shift);
  }
This creates a separate Foo object inside the Bar constructor. It does not construct the base (Foo) of the Bar object.
 
lippmaje:

Thank you