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
What are the 5 oop principles?
What do you mean by abstraction?
What is overriding vs overloading?
What is the renewal class?
What is polymorphism in oops with example?
What are the benefits of polymorphism?
What is object in oops?
What is coupling in oop?
Can we create object of abstract class?
What is encapsulation in simple terms?
What is the real time example of encapsulation?
Can static class have constructor?
What is difference between polymorphism and inheritance?
What is the main feature of oop?
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