TPU ChatChat on IRC
Internet Relay Chat?
Java Applet client
Who's on IRC?
Posted by mattlynam2002 [send private reply] at September 07, 2002, 07:27:43 AM In c++ what's the point of using std::cout << ,when you can just put cout << ! What does std:: mean and do ?
p.s im just starting to program and dont know a thing yet !
Posted by regretfuldaydreamer [send private reply] at September 07, 2002, 08:54:41 AM std is the standard namespace.
If your using <iostream.h> you shouldn't need the std, but if you are using <iostream> you should either write:
Std::cout ... on every line or
using namespace std;
Namespaces are ways of differenciating between two classes or methods of the same name.(Someone will provide a more correct version later).
Posted by taubz [send private reply] at September 07, 2002, 09:20:48 AM So.... there might be a class named cout that exists in another namespace. You'd refer to that class as namespace2::cout. The std:: specifies that you're talking about cout in the std namespace.
using namespace cout; (which you put at the top of your file) means that if you don't specify a namespace when you refer to a class (just "cout"), the compiler will look in that namespace anyway to see if the class exists there. You can have any number of using namespace directives.
See the namespace keyword help.
Posted by unknown_lamer [send private reply] at September 07, 2002, 02:34:50 PM If you want to import a single symbol from another namespace into the current one you do:
using NAMESPACE::SYMBOLSo if you wanted to be able to do cout << ..., you have to do
using std::cout;. Importing an entire namespace into the current one is not generally a good idea.
Posted by mattlynam2002 [send private reply] at September 08, 2002, 07:59:27 AM Ahh i see! OK thanx all !
Register as a new user