[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: C++ Blues




This might clear the problem up:

http://www.cygnus.com/misc/wp/dec96pub/over.html#over.dcl

--

  13.2  Declaration matching                                  [over.dcl]

1 Two function declarations of the same name refer to the same  function
  if  they  are in the same scope and have equivalent parameter declara-
  tions (_over.load_).  A function member of a derived class is  not  in
  the  same scope as a function member of the same name in a base class.

  [Example:

  { ..snip..}
   --end example]

--

It seems that overriding in a derived class actually hides the overridden 
functions.

ie:
class A {public: void foo() {}; void foo(int){};};
class B : public A 
{
public:
 void foo(){};  // hides A::foo() and A::foo(int)
                // So no foo(int) in class B scope as A::foo(int) is 
                // hidden 
};

I guess the soluntion is to define void B::foo(int i){A::foo(i);};

--
	"I reserve the right to contradict myself."
Nicholas Lee (Li Peng Ming)  n.lee with math.auckland.ac in nz
                             nj.lee with kiwa.co in nz
Auckland University, New Zealand