what..is..it..it..is.not..working..with..programs
it stops you from having to type std:: before everything for example
std::cout << "Hello World";
becomes
cout << "Hello World";
I do also believe you cxan use it for other things like in Visual C++ when you generate a form it does some
using namespace system; or something similar
Hope it helped.
we can also use
for the same purpose right??
@tummychoww i am using Turbo C++ that is why i have to include the library file too
Last edited on
Ew. conio is nonstandard. It should generally be avoided. And how can you replace using with the inclusion of another library?
using namespace std;
Introduces every name from the std namespace into the current scope block.
It saves you from having to fully qualify names as Timbo described in his example.
I do also believe you cxan use it for other things like in Visual C++ when you generate a form it does some
using namespace system; or something similar |
I believe you are thinking of one of the .NET managed languages, such as C# or C++/CLI. There is no "system" namespace in the standard C++ libraries.
we can also use
# include <conio.h>
for the same purpose right?? |
No, including a header file has nothing to do with namespaces and name resolution.
See here:
http://www.cplusplus.com/doc/tutorial/namespaces/
Last edited on
about namespace using declarations
http://www.cplusplus.com/forum/beginner/9181/#msg42419
let´s ask the Op a question first: Do You know what namespaces are for?... the understanding of this topic may solve the questions...
another example,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
namespace first
{
double var = 5;
}
namespace second
{
double var = 10;
}
int main () {
std::cout << "5 plus 10 equals " << first::var + second::var << std::endl ;
std::cin.get();
return 0;
}
|
Notice how since you declared namespaces you can use the same variable as long as you put the proper namespace decoration in front of it.
Some one tell me if this is a good example or if it works at all *sigh*
Last edited on