Create a private namespace in C++

Jan 8, 2015 at 11:37am
Hi. I want to create a namespace that supports my whole library files and classes.
But i don't know how to create a namespace.
Can anyone tell me how to do that ?
Jan 8, 2015 at 12:15pm
Jan 8, 2015 at 12:48pm
There is a question here :
if i want to add classes and objects to a namespace from another library ?
for example :
I have a namespace called namespace1.
and i have a library called library.h
i have a function or class in library.h and i want to add it to the namespace1.
Is there any way to do it ?
Jan 8, 2015 at 3:15pm
By editing library.h. Or maybe you can get away with:
1
2
3
namespace namespace1 {
    #include "library.h"
}
Jan 8, 2015 at 6:58pm
What do you mean from Editing library.h ?
Jan 8, 2015 at 9:24pm
library.h:
1
2
3
4
5
6
7
namespace namespace1 {
//this is the first line of library.h
//this is more of library.h
//I have no clue what is here
//there could be a function here
//there could be a class here
}


I suggest reading that tutorial that tath posted.
Last edited on Jan 8, 2015 at 9:24pm
Topic archived. No new replies allowed.