c++ stuffz

Started by
4 comments, last by edwinnie 21 years, 11 months ago
okie, i jus read namespaces and templates. but how much necessity of these 2 are required?
Advertisement
Namespaces are used to stop you writing functions that have the same name as other ones.

Templates are so you can use the same code for multiple types of data, etc.

They''re both just tools, use them when you need to.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
quote:Original post by siaspete
Namespaces are used to stop you writing functions that have the same name as other ones.

Subsitute "allow" for "stop" and you''re good.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Hehe true. It depends how you look at it I guess.

Is it a way to stop the compiler finding 2 functions with the same name and getting confused, or a way for you to write two functions with the same name?

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
It allows you t write two functions with identical name and parameters (by number and type), while it stops the compiler from getting confused.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Of course, to further confuse the situation there is overloading functions and polymorphism built into the language.

______________________________
[Free Books!] [Reference and Tutorials]
[For Beginners] [IGDA]
[OpenGL Tutorials] [Sourceforge]
[DirectX Tutorials] [Gamasutra]

This topic is closed to new replies.

Advertisement