Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!usc!apple!well!jef From: jef@well.sf.ca.us (Jef Poskanzer) Newsgroups: comp.lang.c++ Subject: Re: Will C++ 2.1 fix the virtual function linkage problem? Message-ID: <18305@well.sf.ca.us> Date: 2 Jun 90 20:33:37 GMT References: Reply-To: Jef Poskanzer Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 46 In the referenced message, dove@batman.uucp (Webster &) wrote: >Suppose you allow the derived class to inherit the declaration of the >virtual member. > >class base_class { >public: > virtual base_virtual(); >}; > >int base_class::base_virtual() { ... default behavior ... } > >class derived_class : public base_class { >} > >int derived_class::base_virtual() { ... derived behavior ... } > >This would be back compatible with existing code, not require any new >keywords, and allow me to fix my problem with a library line >InterViews without requiring any changes to the library. This allows >me to explicitly state (by ommision) that I am expecting there to be a >matching inherited virtual and would yield a compile time error if >that linkage failed. I agree that this is a big problem with C++, but your proposed solution seems weird. Explicitly state by omission? What does the derived class do if it doesn't want to re-define the function? Or if it wants to define a totally different function that happens to have the same name? How about if the derived class can declare that it will be re-defining a virtual function without having to re-state the type and arguments of the function? Like this: class derived_class : public base_class { base_virtual; } Hmm, except this doesn't work either if the base class defines more than one virtual function with that name, but with different arguments. I dunno, I just started on C++ a few weeks ago, and already I love/hate it. --- Jef Jef Poskanzer jef@well.sf.ca.us {ucbvax, apple, hplabs}!well!jef "She's not a woman -- she's the Terminator!"