rfg@MCC.COM (Ron Guilmette) (03/15/89)
Now that I can oveload my own per-class new & delete operators, I just had to see if the delete operator could be made virtual just like the destructors can. There seems to be something really fishy about the way you have to declare delete methods though. For instance, I assume that they do implicitly get a this pointer, and that the this pointer points to the thing to be deleted. Is that right? If that is right, then why do you have to declare delete methods with yet another (explicit) parameter? The (apparent) need for the explicit parameter seems to have the side effect of making virtual delete methods virtually (:-) impossible to use. Consider the following code which an early g++ 1.34.0 generates errors for: -------------------------------------------------------------------------- class base { int i; public: virtual void operator delete (base* ptr); }; class derived : public base { int i; public: virtual void operator delete (derived* ptr); // error ??? }; --------------------------------------------------------------------------- // Ron Guilmette - MCC - Experimental (parallel) Systems Kit Project // 3500 West Balcones Center Drive, Austin, TX 78759 - (512)338-3740 // ARPA: rfg@mcc.com // UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg
rfg@ICS.UCI.EDU (11/09/89)
It seems that the property of a class X which makes it a friend class of some other class Y is *not* inherited by classes derived from X (in g++ 1.36.1- at least). Is this a bug or a feature? I seem to recall somebody in comp.lang.c++ saying that this was a language feature, but if that is the case, it sure is uncalled for. // rfg