Programming :: Ep. 17 :: Namespaces and Multiple Files

preview_player
Показать описание
In today's episode we discuss how to split our program into multiple namespaces and files, so that it is easier to maintain, read, and understand.

The major points about namespaces you should understand are:
- Qualified Names (e.g. std::cout)
- Creating a new namespace (e.g. namespace name { ... } )
- Collisions between names within multiple namespaces (e.g. I have a function named squareRoot and so does another library. This is solved by using qualified names.)
- Aliases (e.g. namespace SR = SquareRoot)
- Interfaces (These are used to limit how coupled, which means intraconnected, your project is. So that you can easily change the underlying implementation of a function without modifying the calls to use it. Think about being able to easily switch between writing to a database, a XML file, and an Excel file. They also allow you to hide parts of your implementation from being used by a 3rd party.)
Рекомендации по теме
visit shbcf.ru