In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
C++ Note 1. Int + variable initialization there are only two kinds of direct initialization: use parentheses, int a (10); copy initialization: use =, copy 10; (copy constructor of the object) 2.cin and getline read string cin read string with space as division getline (cin,line) read string, with'\ n'as partition 3. Function pointer
Bool lencom (void)
Typedef bool (* fun) (void)
Fun pf1 = lencom
The fun pf1 = & lencom; / / independent function is equivalent to using the function name directly and adding & before it.
Member functions must use &
4. Default constructor default constructor call timing: when defining an object, the default constructor is called as long as no initializer is provided. Default constructor for a class: even if there is only one constructor defined by a class, the compiler will no longer automatically generate a default constructor to customize the default constructor: the no-parameter constructor is the default constructor for the class.
Use the default constructor:
Sales_item myobj (); # error declares a function instead of defining an object
Sales_item myobj;# is correct, call the default constructor
Sales_item myobj=Sales_item (); # correct, copy assignment
5. When to use the copy constructor: when initializing a newly defined object with an object of the same type, the copy constructor is explicitly used; when an object of that type is passed to or returned from the function, the copy constructor is implicitly used; the elements in the order container are initialized; the array elements are initialized according to the element initializer list. For example, the procedure of vectorsvec (5) for the compiler first creates a temporary value to initialize the svec using the default constructor of string, and then uses the copy constructor to copy the temporary value to each element of the svec. Default copy constructor: if there is no copy constructor for the class, the compiler will always synthesize a copy constructor for the class. The default constructor for this composite behaves as a member-by-member initialization, initializing the new object as a copy of the original object, that is, keeping the non-static members exactly the same. Disable replication using private modifier copy constructor can disable replication
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.