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 is cohesion in oop?

607


Can destructor be overloaded?

591


Why we use classes in oop?

569


write a program to find 2^n+1 ?

1540


What is destructor oops?

611






Why it is called runtime polymorphism?

571


What is abstraction in oop with example?

638


just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.

6479


What is polymorphism in oops with example?

525


What is encapsulation with real life example?

564


What is the difference between inheritance and polymorphism?

581


What is byval and byref? What are differences between them?

1680


Why is static class not inherited?

589


What is interface? When and where is it used?

1656


What is the difference between a constructor and a destructor?

602