What is the use of unnamed namespaces in OOPS?
The only advantage I know is that they dont need the scope
resolution operator while accessing them. I want to know
some other advantages of unnamed namespaces...

Answers were Sorted based on User's Feedback



What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the..

Answer / santosh mundhe

Another advantage is that u can extend namespace within the
same file ....

E.g
#include <iostream>

using namespace std;

namespace
{
int myval;
void funct (int);
}

namespace
{
void funct (int i)
{
cout << i << endl;
}
}

int main()
{
funct(myval);
return 0;
}

Is This Answer Correct ?    1 Yes 0 No

What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the..

Answer / c++ coder

in addition to the advantage mentioned above , there is one
more that the namespace is local to the file and one cannot
use it into another by 'using namespace' since it is
unnamed.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

Difference between vector and array

2 Answers  


can we make game by using c

1 Answers   SmartData,


What is overriding vs overloading?

0 Answers  


is java purely oop Language?

49 Answers   HCL, Infosys, TCS,


how many types of notations are in java

1 Answers   National University of Modern Languages (NUML),


which are the 4 members functions in c++ objects that can either be declared explicitly by programmer or implementation if nt available.

4 Answers  


what is the main difference between sizeof() operator in c and c++

3 Answers  


Can we call a base class method without creating instance?

6 Answers  


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

2 Answers  


What is methods in oop?

0 Answers  


What is oops in simple words?

0 Answers  


What is object and class in oops?

0 Answers  


Categories