Namespaces
Ok... It seems that this is (almost) the last concept of OOP that I haven''t learnt yet. It seems they are useful, but still I haven''t found them in the many books I used (they only refer to them, but doesn''t explain them).
So here are my questions:
What are namespace?
How to implement them? Sources, examples, etc.
What are the plus and minus of Namespace?
What do they do exactly?
How can they help in a program? In a game? In an analysis of a program or a game?
Thanks in advance.
Programming is:
A.The art of debugging a blank sheet of paper (or an empty file).B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.C.The most fun you can have with your clothes on (although clothes are not mandatory).
Now I know what I'm made of, and I'm afraid of it...
I''m not 100% sure, but I think namespace is used to make a block code private like in a class. This way, you can use the same name in global space without name-clashes. Afterwards you can refer to any of them via namespace:: orso...?
mmmmh...
thanks Baskuenen.
Hey! We are often "discussing"[1] together
I don''t think your explanations were enough, but at least you answered something, not like the others who knows. I think I will make a search on it.
[1] Sharing points...
Programming is: A.The art of debugging a blank sheet of paper (or an empty file).B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.C.The most fun you can have with your clothes on (although clothes are not mandatory).
thanks Baskuenen.
Hey! We are often "discussing"[1] together
I don''t think your explanations were enough, but at least you answered something, not like the others who knows. I think I will make a search on it.
[1] Sharing points...
Programming is: A.The art of debugging a blank sheet of paper (or an empty file).B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.C.The most fun you can have with your clothes on (although clothes are not mandatory).
Now I know what I'm made of, and I'm afraid of it...
That is my take on it as well. I think you can be 100% sure now
Namespaces separate functions, variables (I think classes) from the global namespace (the place where all global variable names are).
You can do something like this:
--------------------
You are not a real programmer until you end all your sentences with semicolons;
Namespaces separate functions, variables (I think classes) from the global namespace (the place where all global variable names are).
You can do something like this:
namespace MyNamespace{ int NamespaceVariable;}// you can access it like this, just like a static function in a classMyNamespace::NamespaceVariable = 0;// or you can do this, to bring it into the global namespace (basically undoes the namespace)using namespace MyNamespace;NamespaceVariable = 0;
--------------------
You are not a real programmer until you end all your sentences with semicolons;
Visit the ROAD Programming Website for more programming help.
--------------------
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
It doesn''t affect memory in speed, then. Just accessing different variables. I mean, in assembly it will be the same, just different addresses, is that it?
Thanks. Now I really know what it is Thanks Baskuenen, you were nearer than I thought...
Programming is: A.The art of debugging a blank sheet of paper (or an empty file).B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.C.The most fun you can have with your clothes on (although clothes are not mandatory).
Thanks. Now I really know what it is Thanks Baskuenen, you were nearer than I thought...
Programming is: A.The art of debugging a blank sheet of paper (or an empty file).B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.C.The most fun you can have with your clothes on (although clothes are not mandatory).
Now I know what I'm made of, and I'm afraid of it...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement