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...

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 5 oop principles?

601


What do you mean by abstraction?

613


What is overriding vs overloading?

581


What is the renewal class?

2164


What is polymorphism in oops with example?

529






What are the benefits of polymorphism?

622


What is object in oops?

612


What is coupling in oop?

598


Can we create object of abstract class?

577


What is encapsulation in simple terms?

537


What is the real time example of encapsulation?

595


Can static class have constructor?

585


What is difference between polymorphism and inheritance?

617


What is the main feature of oop?

618


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1652