Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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 Wink

Best regards,
Honza

[Updated on: Mon, 01 August 2011 14:46] by Moderator

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PLATFORM_X11 warnings
Next Topic: BUG? or Not BUG? LoadFile(filename) and then getting wrong data
Goto Forum:
  


Current Time: Sun Jun 09 12:18:15 CEST 2024

Total time taken to generate the page: 0.02083 seconds