Notice: session_start(): A session had already been started - ignoring in /home/u614325693/domains/onedoubt.com/public_html/post.php on line 3
Omitting Namespace - ONEDOUBT.COM

C++ String Namespace


Omitting Namespace

You might see some C++ programs that runs without the standard namespace library. The using namespace std line can be omitted and replaced with the std keyword, followed by the :: operator for string (and cout) objects:

Example

#include
#include

int main() {
  std::string greeting = "Hello";
  std::cout << greeting;
  return 0;
}

It is up to you if you want to include the standard namespace library or not.



Omitting Namespace

Login
ADS CODE