Senile Animal
Baseband Member
- Messages
- 74
- Location
- USA
OK, I suspect that these will be self evident questions but I need them explained in a less textbookish manner. I was on the cpp.com site and read the what/why of namespaces. The definition starts out with a Namespace is a scope. I assumed that scope is an abstract idea and not some object right? My guess is that scope is just a reference to how a function or other object is being called or used or something simmilar correct? I really don't know.
I understand that a namespace is used to group things together in an orderly fasion. So, int, string, double, bool are these namespaces? I know they are types of variables or functions but is this also examples of namespace?
Namespace std is the standard temp library but what exactly does that contain in it? Where can I find the code?
My last question is if namespace std; is the temp library why would you not just always use this instead of single namespace like the example
using std::string;
Again, I know these are probably obvious questions but I am not the best at textbookish explanations.
*edit: One final question. Is it considered a best practice to prototype a function and have it after the main function or is it ok for me to just write the function first then do main?
I understand that a namespace is used to group things together in an orderly fasion. So, int, string, double, bool are these namespaces? I know they are types of variables or functions but is this also examples of namespace?
Namespace std is the standard temp library but what exactly does that contain in it? Where can I find the code?
My last question is if namespace std; is the temp library why would you not just always use this instead of single namespace like the example
using std::string;
Again, I know these are probably obvious questions but I am not the best at textbookish explanations.
*edit: One final question. Is it considered a best practice to prototype a function and have it after the main function or is it ok for me to just write the function first then do main?
Last edited: