Answer the question
In order to leave comments, you need to log in
When should you create your own namespaces?
In what situations in C++ code should you create your own namespaces?
Answer the question
In order to leave comments, you need to log in
In my opinion, this should be done in almost any program, because. this will protect against duplication of function names, and it's easier to navigate through pieces of code this way, and it's a convenient method to split code into modules.
When a system of classes, constants, functions, possibly global variables and objects arises, which describes the essence of one task or a set of related tasks and creates tools for solving them, for any actions with these entities.
For example, a namespace containing classes for describing sockets, IP addresses, connections, functions for creating a connection, accepting an incoming request, sending and receiving data. Or another example: a set of different algorithms for working with matrices, defining the type "matrix" and "vector" as standard or user-defined using / typedef.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question