Combining overloading with inheritence

Carsten WEICH CWeich@frequentis.com
Tue Mar 2 09:57:00 GMT 1999


We are using egcs-1.1, I have encountered a problem as I have combined
member function overloading with inheritence.

The program below compiles if you comment out the line marked with ***.
If the member function declaration C1::M(int) is present, the member
function C::M() in the base type is not found by the compiler.

----------------------------------------------------------------
#include <iostream.h>

class C
{
public:
   M () { cout << "in M()\n"; }
};

class C1: public C
{
public:
   N () { cout << "in N()\n"; }
   M ( int Param ) { cout << "in M(int)\n"; }   // ***
};

main()
{
   C1 o;

   o.M();  // the compiler does not find this member function!
}
----------------------------------------------------------------

Is this a compiler bug or do I understand C++ rules wrong?
Please answer to cweich@frequentis.com, as I am not subscribed
to this mailing list.

Thanks in advance

Carsten

-------------------------------------------------------
Dr. Carsten Weich
System Design
FREQUENTIS
A-1120 Wien, Spittelbreitengasse 34
http://www.frequentis.com
email: cweich@freuquentis.com
te.: +43/1/81150-2330, fax -2299
-------------------------------------------------------



More information about the Gcc-bugs mailing list