Home » U++ Library support » U++ Core » Polymorphic Array doubt
Re: Polymorphic Array doubt [message #33401 is a reply to message #33399] |
Mon, 01 August 2011 07:46 |
|
Hi Koldo,
You need to provide a virtual destructor in your base class, so that the compiler knows it should look in the derived classes as well:struct Number {
virtual double Get() const = 0;
virtual ~Number(){}
};
This will cause both ~Number() and ~{Integer,String}Number() to be called upon deletion. Which in turn removes the leak
Best regards,
Honza
[Updated on: Mon, 01 August 2011 14:46] by Moderator Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Jun 09 12:18:15 CEST 2024
Total time taken to generate the page: 0.02083 seconds
|