class A
{
public:
void x( void ){ };
};
class B : public A
{
public:
void x( int a, int b ){};
};
void main( void )
{
B b;
b.x(); // error function does not take 0 params
}
How it is possible that B cannot see method of A ?
Thx
C++ problem
Hi!
I've got two classes:
What you are experiencing is called hiding. If you create a function in a derived class with the same name as a function in a base class with a different function signature, the function in the derived class hides the function in the base class. You can get around this by changing the name of the function in the derived class or putting a using statement in the derived class.
ex:
ex:
class B : public A{public: void x( int a, int b ){}; using A::x;};
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement