Correct programming with namespaces

Guy

New Member
#1
I wonder what is the right way to use namespace while calling functions or using classes from libraries. Should I always call a function in the format namespace::func()?

I'm a little bit confused because when I'm trying to use the function cout from <iostream> I always need to add the library namespace - std::cout.

But when I'm trying to call a function from <ctime> library which belongs to std namespace, I don't need to add the namespace before the function name.

Why is that?
 

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top