What is Namespace?

Questions by suji   answers by suji

Showing Answers 1 - 5 of 5 Answers

vivek singh

  • Sep 27th, 2005
 

Namespace is a collection of Classes and the classes can be predefined or it can be use defined.we can also defined the Namespace.

  Was this answer useful?  Yes

sandhya

  • Feb 12th, 2014
 

namespace is a global declarative region which consists of variables,functions,classes etc....

  Was this answer useful?  Yes

dinu

  • Oct 3rd, 2016
 

Suppose we have two libraries lib1 and lib2. let there is a function add() present in both of them, this function can have different meaning or functionality in both libraries but they have same name, so it will be conflicting for compiler which function to call? so namespaces are the ways to remove this conflict. for example

Code
  1. span style="font-style: italic;">//it will call add() which belongs to group lib1

  2. lib2::add();//it will call add() which belongs to group lib2

  3. }

  Was this answer useful?  Yes

Girish

  • Jul 20th, 2017
 

We cannot have two variables with the same name in the same scope. To resolve this namespace is introduced.
Namespace is a declarative region that provides a scope to the identifiers inside it. Accessing of these variables can be done using the namespace name::variable name. These namespace declerations appear at global scope.

Code
  1.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions