It is common in large programs or projects to create multiple files and declare variables, functions, classes, etc. with same names which results in collisions of names. In order to eliminate collisions, C++ introduced the concept of namespaces which is a logical space for creating names. A namespace can be created using the keyword namespace and its syntax is as follows: 1 2 3 4 5 6 7 namespace name { //declarations ... ... ... } Essentially a namespace creates a scope of for all the elements inside it. Syntax for accessing an element outside the namespace is as
The post How to use a namespace in C++ Programming appeared first on Coding Security.
How to use a namespace in C++ Programming
read more
Tidak ada komentar:
Posting Komentar