• Welcome to OnlyTech Forums
    An online community for the tech enthusiasts!
    Log in or Register

What is Namespace?

sunveer

Pro
Member
Joined
7 Apr 2011
Messages
246
Reaction score
7
Namespace is basically a group of classes, objects or functions that are given one name.

So to use any predefined class or function in your program, you first have to include the appropriate namespace in your program to use that class or function.
 

Arsh25

Pro
Member
Joined
14 Feb 2011
Messages
103
Reaction score
18
Sunveer ur a programmer? In C++,ie u'r using TC to compile u dnt nee namespace,but for visual studio compiler,u hav to mention "using namespace std"
 

Bapun Raz

Quarantino
Staff member
Administrator
Joined
3 Nov 2010
Messages
22,201
Solutions
4
Reaction score
29,863
Yes arsh he is a engineering student. :)

Arsh25 said:
Sunveer ur a programmer? In C++,ie u'r using TC to compile u dnt nee namespace,but for visual studio compiler,u hav to mention "using namespace std"
 

sunveer

Pro
Member
Joined
7 Apr 2011
Messages
246
Reaction score
7
Using namespace is according to the latest ANSI standards.

TC is an old compiler. Avoid using it.
 

Biswajit.HD

Guru
Member
Joined
5 Aug 2011
Messages
2,290
Reaction score
281
Example of using namespace in C++

#include iostream.h (sorry if i use < >, i whole iostream is missing here)
using namespace std;
{
cout<<"Hello";
}

output : Hello
 

Biswajit.HD

Guru
Member
Joined
5 Aug 2011
Messages
2,290
Reaction score
281
Try in Turbo C compiler in windows or on any Linux Platform.... with the sample program....
 
Top Bottom