0
votes
1answer
164 views

How to use namespaces to separate interface from implementation, in c++?

As far as I can tell, you can make your interface known to others by providing your .h file. Your .cpp is the implementation. Then they can see the function names, the parameter types, the return ...
2
votes
6answers
437 views

Nested Classes or Namespace

Why do need namespaces when we have nested classes. What can be done through namespaces, can also achieved through nested classes. so I don't understand the reasoning of having namespaces ?
0
votes
3answers
566 views

What are the good practices for including namespaces in C++ that avoid more typing?

I am starting out with C++ and almost everywhere I see there is these 2 sentences at the top. #include <iostream> using namespace std; As I understand namespaces are something to keep names ...
0
votes
1answer
430 views

Nested classes vs namespaces

Is it good to use nested classes or should I use namespaces instead? In context: I have a templated codec loader and a codec have In objects and Out objects template<class TypeOfData> class ...
8
votes
4answers
511 views

When to import names into the global namespace? (using x::y, from x import y etc.)

I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
1
vote
1answer
254 views

Does putting types/functions inside namespace make compiler's parsing work easy?

Retaining the names inside namespace will make compiler work less stressful!? For example: // test.cpp #include</*iostream,vector,string,map*/> class vec { /* ... */ }; Take 2 scenarios of ...
15
votes
4answers
4k views

Using static classes as namespaces

I have seen other developers using static classes as namespaces public static class CategoryA { public class Item1 { public void DoSomething() { } } public class Item2 { ...
17
votes
6answers
9k views

Best practices for using namespaces in C++ [closed]

I have read Uncle Bob's Clean Code a few months ago, and it has had a profound impact on the way I write code. Even if it seemed like he was repeating things that every programmer should know, ...