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
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 |
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 |
#include <iostream> using namespace std; int main() { int a = 3; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][2]; }
Can we create object of abstract class?
explain sub-type and sub class? atleast u have differ it into 4 points?
create a c++ program that will ask 10 numbers and display their sum using array.
What is abstraction in oops with example?
143.what is oops principles?
What is Virtual Keyword?
What do you mean by abstraction?
What is interface? When and where is it used?
Program to check whether a word is the first word of the sentence.
Which is the parameter that is added to every non-static member function when it is called?
How to overload postfix operator in c++