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
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.
Thanks