Goldman Sachs Interview Question
Software Engineer / Developersnamespace A {
char x;
};
namespace B {
using namespace A;
int x;
};
int main() {
cout << typeid(B::x).name() << endl;
}
Output would be int.
In a member function definition, the declaration of a local name hides the declaration of a member of the class with the same name.
The declaration of a member in a derived class hides the declaration of a member of a base class of the same name.
defnition of function in derived class hides base class version fucntion ..
Hide a name can by declaring it in an enclosed block.It can be accessed using the scope-resolution operator(::)
- Mary Jaine December 12, 2008