In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "case Analysis of data sharing and Protection of C++". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Now please follow the editor's train of thought slowly and deeply. Let's study and learn "C++ data sharing and protection case analysis"!
1. Scope
A scope is an area where an identifier is valid in the body of a program.
The scope relationship from large to small is:
Namespace scope > class scope > local scope
The valid range of identifiers is the visibility of identifiers, and the general rules for visibility are:
The identifier is declared before and used after
Identifiers with the same name cannot be declared in the same scope
Identifiers of the same name declared in different scopes that do not contain relationships do not affect each other
If an identifier with the same name is defined in more than one scope, the outer identifier is not visible in the inner layer
two。 Object lifetime
If the object lifetime is the same as the run time of the program, it has a static lifetime
The local lifetime object is born at the declaration point and ends at the end of the block in which the declaration is executed.
Objects declared in the namespace scope have a static lifetime
A static lifetime variable of the base type with no initial value specified at the time of definition is initialized with a value of 0.
If you want to declare an object with a static lifetime in the local scope within the function, use the keyword static
Void f () {static int masks 0; / / m can only access masks in f; cout
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.