Article View: gnu.g++.bug
Article #935pure virtual function definition rejected
From: Peter C. McCluskey
Date: Thu, 10 Sep 1992 15:29
Date: Thu, 10 Sep 1992 15:29
16 lines
877 bytes
877 bytes
class A
{
public:
virtual void foo() = 0;
};
void A::foo(){}
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
td.cc: In method `void A::foo ()':
td.cc:6: redefinition of `void A::foo ()'
td.cc:4: here is the previous declaration of `void A::foo ()'
cfront considers this legal.
According to r.10.3 (p 560 of Stroustrup 2nd. ed): "A pure
virtual function need be defined only if explicitly called ...".
See also Scott Meyers Effective C++, p 47.
Technical Details
Message-ID:
<9209102329.AA29449@kato.cs.brown.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.brown.edu!pcmShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.brown.edu!pcm From: pcm@cs.brown.edu (Peter C. McCluskey) Subject: pure virtual function definition rejected Message-ID: <9209102329.AA29449@kato.cs.brown.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 10 Sep 1992 15:29:24 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 17