Parent destructor override

To add comments, please log in or register
Petr Nosek
3023
Petr Nosek  
I want to use classes inherited from CChartObject (Metaquotes standard library). For example, I want my script to draw a trend line by using CChartObjectTrend class. But the parent class (CChartObject) destructor contains deleting the object. That means when the script is ended the trend line is deleted (by parent destructor) from the chart. That doesn't make me a sense. Could I change this behaviour? I'm not sure but I don't think so because I can't disable calling of the parent destructor and I neither can override the parent destructor. Or do I miss something? Of course, I can copy and paste the code and then write my own destructor (without deleting an object) but I want to try finding another solution. Could somebody help me? Is there any possibility to disable deleting an object by the parent class destructor?
Alain Verleyen
38676
Alain Verleyen  
Use Detach() method.
Petr Nosek
3023
Petr Nosek  
Alain Verleyen:
Use Detach() method.

Yes, that could be a solution. Thank you Alain.

To add comments, please log in or register