Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!milano!pp!riunite!rfg From: rfg@riunite.ACA.MCC.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: cant use virtuals in base constructors Message-ID: <198@riunite.ACA.MCC.COM> Date: 8 May 89 15:35:00 GMT References: <11492@ulysses.homer.nj.att.com> Reply-To: rfg@riunite.UUCP (Ron Guilmette) Distribution: comp Organization: MCC Austin, Texas Lines: 38 In article <11492@ulysses.homer.nj.att.com> jss@hector.UUCP (Jerry Schwarz) writes: > >In the pre-release of 2.0 there is a way to detect this at compile >time. > >class B { >public: virtual void f() = 0 ; // f must be supplanted in all > // derived classes. Allocation of > // a B (directly or via new) is not > // allowed. >} ; That's terrific! I mean it! We have been needing a feature like this! One question. You said that "f must be supplanted" in all derived classes. Supplanted how? Will this be legal? (I hope so!) class base { public: virtual void f() = 0; }; class middle : public base { public: virtual void f() = 0; // force leaves to supplant f() }; class derived : public middle { public: virtual void f() {} // finally! }; -- // Ron Guilmette - MCC - Experimental 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