In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use C++ 's namespace". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use C++ 's namespace".
The namespace contains a set of classes, functions, templates, and so on that are logically related to each other. A namespace is like a container that puts together and distinguishes certain "objects" that are logically structurally related. In particular, a variable name or class name in a namespace can be renamed with a variable name or class name outside the namespace.
When using a namespace, we can enclose the declaration block in curly braces, start with the keyword namespace and name it. The basic format is as follows:
The name of the namespace namespace {declare block}
The declaration block can contain variables, classes, functions, and so on. Eg:
Namespace S {int x; void FunA () {...}} scope operator:
Use members within the namespace outside the namespace: the name of the namespace plus the scope operator::.
Referring to the above example namespace S, if you access x, it can be written as S::FunA (); if you access FunA (), it will be SRV ().
Using statement
Using declaration: if a member in the namespace uses the using declaration, then the member can directly use the member name for subsequent use of the program without adding a qualified modifier name. Declare using using: start with the keyword using followed by the name of the member in the namespace. Refer to the nested namespace in the previous example:
Thank you for your reading, the above is the content of "how to use C++ 's namespace". After the study of this article, I believe you have a deeper understanding of how to use C++ 's namespace, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.