In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to use C++". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The following is a practical case to illustrate the concept of C++. In the world, there are often objects belonging to the same category. For example, the computer you are using is just one of many computers in the world. In object-oriented software, there are also many different objects that share the same characteristics.
First of all, a C++ class with no obvious members, its size is not 0, because it is actually not empty, it has been installed by the compiler a char, in order to enable the C++ class's two objects can be assigned * addresses in memory. As for the two derived C++ classes Y and Z, because of the burden caused by the language itself, as well as the compiler's optimization for special cases, and the limitations of Alignment, the result becomes 8. 5. How is this 8 made up?
Typedef int length; / / zai class point3d {public: / / length is decided to be global typedef, that is, int / / _ val is decided to be Point3d::_val void mumble (length val) {_ val=val;} length mumble () {return _ val;} / /. Private: / / length must be seen before this class has * reference operations on it / / such a declaration would make the previous reference operations illegal typedef float length; length _ val; / /...
However, it is important to note that the results of different compilers Y and Z sizes will be different. Because the new compiler treats an empty virtual base class as the beginning of a derived class object, the derived class has a member, so it is not necessary to assign the bytes of the char. There is no need to fill the 3 bytes, so it is possible in some compilers
Point3d Point3d::translate (const Point3d & pt) {x, y, y, z, y, etc.
Thor 1, 4, 8. I don't know if you understand it or not, but this third chapter does read much more smoothly than the first two chapters. Let's move on to Data Member's Binding, and now we only need to remember one defensive style for binding data members: always put the declaration of nested types at the beginning of the class, which ensures that the non-intuitive binding is correct. Look at the following example:
Class X {}; class Y:public virtual class X {}; class Z:public virtual class X {}; class A:public Y Magi public Z {}
How to copy books, Thor is also unconsciously, maybe it is easier to understand this chapter, there is no need to think of something you can see and touch. It seems that children learn arithmetic. Single-digit calculations do not need fingers, but two-digit or three-digit calculations, fingers plus toes are still not enough. That's what learning is all about. Comprehension and abstraction are important. Come back and continue to study.
I also know through this chapter. Layout of the data member. Access to data members. And have a better understanding of Static data members, in the life cycle of class, static members are regarded as global variables, access to each member will not cause any additional space or efficiency burden. Whether inherited from a complex inheritance relationship or directly declared.
Static data member will have only one entity. And has a very direct access path. In addition, if both C++ classes declare a static member variable with the same name, then the compiler will solve the name conflict problem for us through an algorithm. The storage and removal of non-static member variables is actually done through implicit class object (this pointer).
This is the end of the content of "how to use C++". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.