int CStrategy_MA1::OnInit( string Sym, ENUM_TIMEFRAMES Per ) { CStrategy::OnInit( Sym, Per ); // more initialisation stuff here // . // . // . return(0); }
See also Scope Resolution Operation:
#property script_show_inputs #import "kernel32.dll" int GetLastError(void); #import class CCheckContext { int m_id; public: CCheckContext() { m_id=1234; } protected: int GetLastError() { return(m_id); } }; class CCheckContext2 : public CCheckContext { int m_id2; public: CCheckContext2() { m_id2=5678; } void Print(); protected: int GetLastError() { return(m_id2); } }; void CCheckContext2::Print() { ::Print("Terminal GetLastError",::GetLastError()); ::Print("kernel32 GetLastError",kernel32::GetLastError()); ::Print("parent GetLastError",CCheckContext::GetLastError()); ::Print("our GetLastError",GetLastError()); } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CCheckContext2 test; test.Print(); }
Thank you both Stringo and Rosh. I know I had read it somewhere, but I couldn't find it afterwards.
Jellybean

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
Hi
Is is possible to call a function in an inherited class from the function that overrides it? This is useful to avoid duplicating code when several classes inherit from one base class. A simple example is below.
Thanks, Jellybean