what is the use of Namespace in c++.

Answers were Sorted based on User's Feedback



what is the use of Namespace in c++...

Answer / ramprasad g

The use of namespace is to avoid clash during naming of
variable,classes etc.

Suppose a company wants to release its version of a
function, it can create a separate namespace and then create a
function within that namespace.Another company can create a
function of same name, as long as it is in different
namespace.And the third company can use both the functions
in the same program by using resolving the namespace.


pakage concept of Java is a similar idea.

Is This Answer Correct ?    20 Yes 2 No

what is the use of Namespace in c++...

Answer / snigdhadeb ash.

Namespace is a new concept introduced by the ANSI C++
standards committee. This defines a scops for the
identifiers that are used in a program. For using the
identifiers defined in the namespace scope we must include
the using directive,like
using namespace std;
Here , std is the namespace where ANSI C++ standard class
libraries are defined. All ANSI C++ programs must include
this directive. This will bring all the identifiers defined
in std to the current global scope. using and namespace are
the new keywords of C++.

Is This Answer Correct ?    0 Yes 0 No

what is the use of Namespace in c++...

Answer / achal ubbott

Template feature came to c++ quite later from its birth. It
basically helps some big coders.
Now if u buy 2 libraries from market and both of these
define a class Ethernet; Then if u use both of them in your
code the copiler will give some redeclaration of class
errors. So this Namespace feature helps the coder to
differentiate among the two.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C++ General Interview Questions

How to demonstrate the use of a variable?

0 Answers  


What is the difference between global variables and local variable

0 Answers  


What is size of a object of following class? class Foo { public: void foo(){} }

2 Answers   CA,


There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.

0 Answers  


How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?

0 Answers  






What is iterator in c++?

0 Answers  


What are the techniques you use for debugging?

1 Answers   Adtran,


What is meant by forward referencing and when should it be used?

0 Answers  


How does c++ structure differ from c++ class?

0 Answers  


What are static and dynamic type checking?

0 Answers  


Explain how an exception handler is defined and invoked in a Program.

0 Answers  


What is flag in computer?

0 Answers  


Categories