[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    Problems with gcc 2.95.3
From:       Christof Nuber <cnuber () ucdavis ! edu>
Date:       2001-12-31 0:44:34
[Download RAW message or body]

Hi,

I encountered a problem in the gcc 2.95.3 (version 2.95.3, 20010315 
(release)) under Red-Hat-Linux 7.1. 

The following code does not compile unless I replace 'get(x)' in 'int 
B::get(int&, const int) const' to 'A::get(x)' what I don't want to do as 
there might be classes inbetween overwriting the get(x)-call. As B is derived 
from A, there should (?!) be no problem without using the A:: for the 
get(x)-call.

The error-message is as follows:
class.cxx: In method `int B::get(int &, int) const':
class.cxx:17: no matching function for call to `B::get (int &) const'
class.cxx:16: candidates are: int B::get(int &, int) const

Any suggestions which compiler to use instead? Using 2.96 is out of the 
question, as I get my programs compiled but not executed as intended.

Chris

------------------------------------------------

class A {
 public:
  void get ( int& x ) const;
  virtual int get ( int& x, const int l ) const = 0;
};

class B : public A {
 public:
  int get ( int& x, const int l ) const;
};

void A::get ( int& x ) const {
  x = 1;
}

int B::get ( int& x, const int l ) const {
  get (x);
  x = 2;
  return 5;
}

int main () {
  B b;

  int	x, l;

  b.get ( x, l );

}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic