Problems using "using"

if you write in the code the command “using namespace xxx” you normally make the code look cleaner. However, there exists the possibility of “overloading” a function if you “use” more than one namespace which has that function defined. E.g.

Using namespace brownies
Using namespace cookies

They both have the function “sugar” in them. If you now put a command such as sugar(100), then the code will go crazy as it doesn’t know which of the two namespaces it should use.

If one uses “using” above the rest of the code, there is a risk that the same namespace may be contained within other libraries one may be using. This would result in a namespace clash.

Privacy & Terms