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

What is Namespace?

sunveer

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

Member
Joined
14 Feb 2011
Messages
101
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

Staff member
Community Manager
Joined
3 Nov 2010
Messages
25,523
Solutions
5
Reaction score
34,006
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

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

Member
Joined
5 Aug 2011
Messages
2,288
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

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

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock