Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) using

 

 

 

 

 

using is a keyword to specify the a namespace(s) used or the namespace(s) of the data types used.

 

 

 

 

 

Example: using to specify the namespace(s) of the data types used

 

#include <iostream>
#include <string>

int main()
{
  using std::cout;
  using std::string;
  const string s = "Hello world";
  cout << s;
}

 

 

 

 

 

Example: using to specify the namespace(s) used

 

#include <iostream>
#include <string>

int main()
{
  using namespace std;
  const string s = "Hello world";
  cout << s;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict