2

I wanna declare a single namespace (let's say "Mynamespace")across multiple files like namespace "std" it is declared across multiple header files like "iostream" and "array" and "vector" etc ...(I declared them in two header files only )

how can I do that ?

Mekacher Anis
  • 183
  • 1
  • 1
  • 11

1 Answers1

2

In each file you do the namespace declaration as usual. No tricks needed.

A namespace is not like a class, you can add to is as you see fit.

Or as Andrew Hare succinctly says in the duplicate:

Yes, that is exactly how to do it.

Captain Giraffe
  • 14,407
  • 6
  • 39
  • 67