Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!pp!riunite!rfg From: rfg@riunite.ACA.MCC.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: fixing pitfall in virtual members Message-ID: <91@riunite.ACA.MCC.COM> Date: 18 Feb 89 21:49:44 GMT References: Reply-To: rfg@riunite.UUCP (Ron Guilmette) Distribution: comp Organization: MCC Austin, Texas Lines: 27 In article dove@rocket.stars.flab.Fujitsu.JUNET (Webster Dove) writes: >I have recently had two staff waste a day each chasing very similar >problems with virtual members. <<... a sad story ensues ... >> >...Since C++ requires that the base class provide a default [virtual] member, >the package has one which does *nothing*. Therefore, the programs >compiled without any warnings. However, when they were run the >results were very obscure behaviors that took considerable skill and >effort to diagnose. Please correct me if I am wrong, but couldn't you have avoided your trouble if you had defined the "default" virtual member function in the base class to do something which would let you know that it had been called by mistake, e.g. calling abort() or something? That is what I do when I have virtual member function declared in a base class which are just there as "placeholders" are which are not supposed to be called in practice. -- // 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