Jamāl
Jamāl

Reputation: 121

Is function name also a namespace?

I'm new to c++ and was reading up about namespaces on dfs-minded and came across this,

using my_fancy_app::HelpfulFunc; // bring it to the scope
HelpfulFunc();
 
// or just
 
my_fancy_app::HelpfulFunc(); // fully qualified name

My doubt is why HelpfulFunc is appended to 'using myfancy_app'. Can't we just do:

using my_fancy_app;
HelpfulFunc();

Upvotes: 1

Views: 267

Answers (1)

eerorika
eerorika

Reputation: 238461

Is function name also a namespace?

No. Function name is not a namespace.

my_fancy_app::HelpfulFunc(); // fully qualified name

The comment is a bit wrong. That is a qualified name, but not a dully qualified name. A fully qualified name would be ::my_fancy_app::HelpfulFunc.

Upvotes: 1

Related Questions