ok, if i create structures or constants, or classes thaat already have been declared in C++, can i create a namespace for my program, so that it wont matter?(i know what namespaces are, i just wanna know if i can put my whole program in them)
Thanks
Printable View
ok, if i create structures or constants, or classes thaat already have been declared in C++, can i create a namespace for my program, so that it wont matter?(i know what namespaces are, i just wanna know if i can put my whole program in them)
Thanks
Yes, namespaces are just for data abstraction, so you can put your whole program in one.
Not data abstraction, just to prevent name collisions. For example, you could do this::cool:Code:#include <iostream>
namespace MyProgram {
class string {
// Your own string class
};
};
int main() {
std::string x = "Hello";
MyProgram::string y = "Another";
return 0;
}