tgghaus.com
tgghaus.com
Home | Profile | Active Topics | Members | Search | FAQ
 All Forums
 Combat PA Forums
 General Chit Chat
 Question to Krusty and other programmers

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   
   

T O P I C    R E V I E W
Admax88 Posted - 03/01/2004 : 11:16:57
One concept I don't understand about programming are namespaces. What is a namespace? Could you explain them to me Krusty?

5   L A T E S T    R E P L I E S    (Newest First)
Krusty Posted - 03/01/2004 : 19:12:36
VGRA

Admax88 Posted - 03/01/2004 : 16:31:34
YAY! It all makes sense now. I knew it was something like that but it just didn't seem to click. Thanks Krusty.

na85 Posted - 03/01/2004 : 16:30:28
Sorry to butt into a thread that has nothing to do with me, but:

quote:
a namespace is a space of names


LOL. Really?

They call me Sodium
Krusty Posted - 03/01/2004 : 15:12:29
Hmm...don't really know how to describe it well, but here goes:

a namespace is a space of names

When you are using C++ and type using namespace std, that means that you are using stuff in the namespace that starts with std. If you didn't use that line, and you wanted to do something like a cin statement, you'd have to type something like std::cin.

cin and cout are both in the std namespace. The using command there lets you know you are using stuff in the std namespace and not any other namespace. There could be another cin and cout in foo::cin or something.

Ok, now for another example for namespaces:

namespace this{
int foo = 12
}

namespace that{
float foo = 6.1828
}

using namespace this
cout << foo

using namespace that
cout << foo

^^one of those would output 12 and the other would output 6.1828 because the namespace used is different in each.



Admax88 Posted - 03/01/2004 : 13:52:35
I just read about them in my book, but the book wasn't very clear, although I think I understand them.


tgghaus.com © 2009 Integral Corporation Go To Top Of Page
Snitz Forums 2000