To shadow a member means to declare one in such a way that it hides one declared in outer scope:
struct A { void foo(int x) { std::cout << "A" << std::endl; }};struct B : public A { void foo(int x) { std::cout << "B" << std::endl; }};int main(int argc, char**argv) { A a; B b; a.foo(10); b.foo(20); A * ap = new A(); A * bp = new B(); ap->foo(10); bp->foo(20);}
Unlike virtual methods, foo() will not be disambiguated when calling it on ap or bp, since it's not a virtual method.
Another example:
void foo(){ int x = 10; while (true) { int x = 20; std::cout << x; }};
While not directly shadowing, and valid, x inside the loop hides the outer x. This is generally a bad practice.
Shadowing methods has (had) certain limited uses (Delphi had special OO concepts centered around them), but in general it will likely lead to confusion.