logo codesdope

what is a namespace in c++?

   Shreyoshi


Answers

  •    Tannishtha Sengupta , BPPIMT

    A namespace can be defined in several parts and so a namespace is made up of the sum of its separately defined parts. The separate parts of a namespace can be spread over multiple files.

    So, if one part of the namespace requires a name defined in another file, that name must still be declared. Writing a following namespace definition either defines a new namespace or adds new elements to an existing one −

    namespace namespace_name {
       // code declarations
    }

    All the files in the C++ standard library declare all of its entities within the std namespace. That is why we have generally included the using namespace std; statement in all programs that used any entity defined in iostream.



Write your answer
Close

Welcome.please sign up.

Close

Welcome.please login.