C + + review Note One (declaration definition of a class applied and constructor destructor section)Const in C is "a variable that cannot be changed", whereas in C + + The seed is "a constant of type description", constants must be initialized and
I. constructor initialization list
We recommend that you initialize the constructor in the initialization list.The execution of constructor is divided into two phases.
Initialization Section
Common Calculation Section
(1) object members and
today just read the Java IO Stream operation, the main context looked over, can not guarantee the use of later can be handy, but at least when used to know that there is such a function can be achieved, the following for a brief summary of
Today just read the Java IO Stream operation, the main context looked over, can not guarantee the use of later can be handy, but at least when used to know that there is such a function can be achieved, the following for a brief summary of
VariableBuilt-in types
In C + +, the definition of a type is basically the same as the C language, except for some differences. In C + +, the return type of the main () function must be of type int, as described in C + + primer. This has not
The const -defined constants are freed after the function executes, and static constants defined by the statics are not freed when the function is executed. However, whether they are const or static, the content they define will be known to the
A const-defined constant is freed after its scope has been exceeded, and static constants defined by Statics do not release their storage space after the function executes.Static is expressed statically. Static member functions and static member
Initializes a list of class constructors, for exampleThe construction of an object is divided into two parts, first allocating space, and then initializing it.Whenever an object is generated, regardless of the form, the constructor is called to
Programming
An event is a member that enables an object or class to provide a bulletin. Users can add executable code to an event by providing an event handle. Events are declared using an event declaration:
An event declaration can be either an
17.1.4 re-Throw
After some corrective actions are performed, the catch may determine that the exception must be handled by a function at the upper layer of the function call chain. The catch can be throttled by rethrow) pass the exception to the
In C + +, there are three major functions of copy control (copy constructor, assignment operator, destructor), and in C++11, move constructor is added to move assignment operator. I would venture to name them six functions.First, the constructor
Part 3 category and data abstraction
[Chapter 1 category]The basic idea behind classes is data abstraction and encapsulation. If a function is a const, the const must be specified in the declaration and definition of the function. Otherwise, an
The space of a constant defined by const is released after the function is executed, while the static constant defined by static is not released after the function is executed.
Static indicates static. Static member functions of a class. member
C ++ Primer study note _ 19 _ class and data abstraction (5) _ initialization list (const and reference member), copy constructor, primer_19
C ++ Primer study note _ 19 _ class and data abstraction (5) _ initialization list (const and reference
C ++ collection (5)-class, Collection
Class is the most important feature in C ++. Early versions of the C ++ language were named "C (Cwith Classes)" to emphasize the central role of the class mechanism. With the evolution of languages, supporting
Const
Modify the variable. The variable is assigned a value during initialization and cannot be modified during the program running.
The default value of a non-const variable is extern. To make the const variable accessible in other files, it must
In C + +, there are three major functions of copy control (copy constructor, assignment operator, destructor), and in C++11, move constructor is added to move assignment operator. I would venture to name them six functions.First, the constructor
15th. Object-Oriented Programming OOP (Object-oriented programming)Object-oriented programming is based on three basic concepts: Data Abstraction , inheritance , and dynamic binding 。 In C + +, you use classes for data abstraction, and class
Constructors
Constructors are special member functions that perform constructors whenever a new object of the class type is created. There is no limit to the number of constructors declared by a class. As long as the formal parameter list of each
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.