is there a way to call base virtual function from descendant ?

 

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 

 

Have you read this topic?

Could give us some example? 

 
alexvd:

Have you read this topic?

Could give us some example? 

Actually I tried it and it does work... Here is an 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" 

 
irusoh1:
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" 

It wont be realized.
 
irusoh1:

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" 

Of course. You need to know.
Reason: