In your header files. See the purpose on namespaces is to separate code into more distinct groups. For example, consider two people writing a class called File, or some such. If you want to use both of these, for whatever reason, then their names would be ambiguous. If you put each users class in differently name namespaces you can qualify one or the other more easily.
Dave
header problem
Quote:Original post by Servant of the Lord
Okay, on a unrelated topic this line doesn't work.
(In my .cpp file)
cin.get();
It compiles, it just doesn't wait for a key press. I could use system("pause"); but I would rather not.
Try: cin.get(); cin.get(); [wink] Some character from previous input is eating away the first cin.get() it sounds like.
Quote:Original post by Servant of the Lord
Okay, on a unrelated topic this line doesn't work.
(In my .cpp file)
cin.get();
It compiles, it just doesn't wait for a key press. I could use system("pause"); but I would rather not.
Hey,
Right well i use this to halt for a key press:
unsigned int a; std::cin >> a;
Dave
Quote:Original post by Dave
In your header files. See the purpose on namespaces is to separate code into more distinct groups. For example, consider two people writing a class called File, or some such. If you want to use both of these, for whatever reason, then their names would be ambiguous. If you put each users class in differently name namespaces you can qualify one or the other more easily.
Dave
Ahh..., I think I understand. So if there is two type of classes named 'cout' I would using namespace std::cout; so I don't have to type 'std::' on one type, but still type whatever::cout whenever I use the second class 'cout'?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement