what is the use of Namespace in c++.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Write about an iterator class?
When should you use multiple inheritance?
List the features of oops in c++?
Is there any difference between int [] a and int a [] in c++?
What is math h in c++?
sir i want to study the c++ course but ino what is the qualification and the study methode please reply more details in c++
If dog is a friend of boy, is boy a friend of dog?
What is a catch statement?
What are the advantages of using friend classes?
class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What is the error in the sample code above? a) The class X does not have any protected members. b) The static member function f() accesses the non-static z. c) The static member function f() accesses the non-static x. d) The member function f() must return a value. e) The class X does not have any private members.
What is atoi in c++?
In what situations do you have to use initialization list rather than assignment in constructors?