Skip to main content
gamedev.net
🔒 Locked

c++ namespace

Started by Heretik 0 replies 200+ views
Original Post
Heretik
Heretik
can someone explain how does namespace work? it seem to be useful to avoid name collision, but I don''t understand it completely, please answer with some examples. thanks
Heretik at bender77@caramail.com
elis-cool
elis-cool
Not to sound critical but its fairly easy, all its there for as you said, is too avoid name collisions in your program... eg when using external librarys like STL or you might find a sound or graphic library on the net that you use and it might have "hello" as a variable, so you would not be able to use that name but if its in a namespace you can use it and to access that variable you would just have to write:
NamespaceName::hello 


CEO Plunder Studios
[email=esheppard@gmail.com]esheppard@gmail.com[/email]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.