Article View: comp.std.c++
Article #333Inheritance in cfront and g++
From: David Fox
Date: Wed, 15 Aug 1990 14:10
Date: Wed, 15 Aug 1990 14:10
25 lines
921 bytes
921 bytes
In porting code from g++ to cfront I have come across the following
inconsistancy. The following program compiles as-is in g++
class A {
public:
void f(int);
};
class B : public A {
public:
void f(char*);
//void f(int i) {A::f(i);}
};
main()
{
B x;
x.f(3);
}
And the call to x.f(3) finds the function f in class A. In
cfront, however, the function f in class B "masks" the f in
class A, so you need the commented f(int) member function to
get this to compile. To me, the g++ semantics make more sense.
Do others agree?
Technical Details
Message-ID:
<FOX.90Aug15101045@devo.allegra.att.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!ucbvax!ulysses!foxShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!ucbvax!ulysses!fox From: fox@allegra.att.com (David Fox) Newsgroups: comp.std.c++ Subject: Inheritance in cfront and g++ Message-ID: <FOX.90Aug15101045@devo.allegra.att.com> Date: 15 Aug 90 14:10:45 GMT Sender: netnews@ulysses.att.com Distribution: comp Organization: AT&T Bell Laboratories Lines: 25