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

what is oops

4 Answers   NIIT,


What is destructor example?

0 Answers  


What is the difference between encapsulation and polymorphism?

0 Answers  


What is interface? When and where is it used?

0 Answers  


How can i write a code in c# to take a number from the user and then find all the prime numbers till the number entered by the user.

4 Answers   NIIT, TCS,






WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP

2 Answers  


what is the realstic modeling?

1 Answers  


How to calculate the age from the date of birth by using the program?

2 Answers   Accenture,


How to overload new operator in c++

2 Answers  


Child cObj = new Parent() Wahts the output ?

8 Answers   Patni, TCS,


create a class complex having real and imaginary part of a complex no. as a data member. overload the binary operators(+,- and *) to perform the operations on complex no. objects. overload binary operator using friend function.

2 Answers   CTS, Delhi University,


The IT giant Tirnop has recently crossed a head count of 150000 and earnings of $7 billion. As one of the forerunners in the technology front, Tirnop continues to lead the way in products and services in India. At Tirnop, all programmers are equal in every respect. They receive identical salaries and also write code at the same rate. Suppose 14 such programmers take 14 minutes to write 14 lines of code in total. How long will in take 5 programmers to write 5 lines of code in total ?

6 Answers   TCS,


Categories