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

Is abstract thinking intelligence?

774


Are polymorphisms mutations?

882


Why do we use polymorphism?

750


Which language is not a true object oriented programming language?

855


What are the types of abstraction?

755


Can we define a class within the interface?

780


What do you mean by Encapsulation?

799


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

903


What is basic concept of oop?

880


What polymorphism means?

801


How is polymorphism achieved?

763


Why interface is used?

731


What is class in oop with example?

815


Why multiple inheritance is not allowed?

786


Why do pointers exist?

858