Article View: comp.std.c++
Article #3465Legal C++ code?
From: Tim Hollebeek
Date: Fri, 16 Feb 1996 04:15
Date: Fri, 16 Feb 1996 04:15
27 lines
1404 bytes
1404 bytes
Is the following legal C++ code? g++ compiles it, but it doesn't link
(undefined function Foo::foo()). I'm suprised it compiles at all:
class Foo {
public:
virtual int foo() = 0;
};
class Bar : public Foo {
public:
int foo() { return Foo::foo(); }
};
int main() {
Bar bar;
bar.foo();
}
---------------------------------------------------------------------------
Tim Hollebeek | Disclaimer :=> Everything above is a true statement,
<space for rent> | for sufficiently false values of true.
Princeton Univ. | email: tim@wfn-shop.princeton.edu
-------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. Moderation policy:
http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID:
<4fvtk3$16j@cnn.Princeton.EDU>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backShow Full Headers
Complete Article Headers
From: tim@franck.Princeton.EDU (Tim Hollebeek) Message-ID: <4fvtk3$16j@cnn.Princeton.EDU> X-Original-Date: 15 Feb 1996 18:21:55 GMT Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 16 Feb 96 04:15:15 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Subject: Legal C++ code? Organization: Princeton University X-Newsreader: TIN [version 1.2 PL2] X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMSQE5uEDnX0m9pzZAQF7BwF+L6zrIaMaVjOx0SVAZ3Or91fk8rsEL/nt 9GvPVwJWlu3Orn2645zPoAjETikbSYBU =IlFJ