What is a name space, why should I use it?

zhaozj2021-02-17  51

The reason is only one sentence: Determine the namespace of an object to help avoid name conflicts in your program, especially in a large program, this decision is also important.

A typical standard C namespace comparative statement such as: use namespace std; (pay attention to the subunies behind, can not be omitted)

But even use "Using Namespace Std;", you still can't avoid name conflicts. Because you bring all the names in the STD name in the entire program, it is generally not recommended to use "useing namespace std;", if you really need it, it is recommended that you use some objects when you use it. Format:

STD: Object Name, such as: std :: cout, std :: cin, etc.

转载请注明原文地址:https://www.9cbs.com/read-29124.html

New Post(0)