Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: Overloaded operator new VS. inheritance Message-ID: <70044@microsoft.UUCP> Date: 15 Jan 91 18:49:15 GMT References: <1991Jan10.195541.6003@usenet@scion.CS.ORST.EDU> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 19 In article <1991Jan10.195541.6003@usenet@scion.CS.ORST.EDU> keffert@jacobs.cs.orst.edu (Thomas Keffer) writes: >I've been using overloaded new and delete operators .... >But then what about the delete operator? The size of the object is >NOT passed to Small::operator delete. I don't know where to put the >recently freed object. According to ARM, page 283, you can declare an overloaded operator delete with two parms: class Y { // ... void operator delete(void*, size_t); }; in which case the second parameter will be filled in by the compiler to indicate the size of the object to be deleted. The size passed by the compiler is determined either from the static type of the pointer, or by the destructor call, if any. Hope this helps.