How does one use the Keyword "using" in the C++ language. How is it declared, and how is it used. Explanation and an example would be great
Thanks in advance...
Printable View
How does one use the Keyword "using" in the C++ language. How is it declared, and how is it used. Explanation and an example would be great
Thanks in advance...
Check in namespaces for info. It is a way to distinguish between 2 different variables/functions:
namespace Jack
{
void fetch();
}
namespace Jill
{
double fetch;
}
using Jill::fetch; //tells compiler which one you want or you could write:
using namespace Jill;
cin >> fetch;
//mostly it's used to make definitions visible for an include file:
#include <iostream>
using namespace std;
Older compilers may not recognize the namespace keyword so you'll need to declare:
#include <iostream.h>
hope this helps.
Steve Stofka
using namespace std; means "please use this list of names so that U can avoid names conflict" as far as I understand.