Have you read this topic?
Could give us some example?
class CHello { public: virtual string echo() { return("Hello "); } }; class CWorld : CHello { public: virtual string echo() { return(CHello::echo() + "World "); } }; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { CWorld world; printf("%s",world.echo()); }
output:
2010.07.16 12:57:42 AccountInfo (EURUSD,M1) Hello World
in other words it allows to perform some common code for all the descendants in the base class
Here you need to know the name of the base class to call it. In other languages there is a generic name for this like "base::echo"
Actually I tried it and it does work... Here is an example.
output:
2010.07.16 12:57:42 AccountInfo (EURUSD,M1) Hello World
in other words it allows to perform some common code for all the descendants in the base class
Here you need to know the name of the base class to call it. In other languages there is a generic name for this like "base::echo"
Here you need to know the name of the base class to call it. In other languages there is a generic name for this like "base::echo"
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
is there a way to call base virtual function from descendant ? (eom)
sometimes virtual function from base class can define common action for descendant classes before or after specific action the descandant performs just like destructors go down the chain