Valid c ++ Study Notes
Clause 1:
The C ++ language can be seen as a mixture of multiple sub-languages.
1,C
2,Template
3,STL
4,Class
Clause 2:
1,For simple constants, such as constants that declare the length of an array in a class, you can use
ENum{}, You can use
Constexpr static or const staticTo replace,
2,# Define cannot support encapsulation., Avoid as much as possible, of course, like
# Ifdef, # endif Still useful (the compiler will directly replace the macro used)
3. Use inline to replace macros such as functions (otherwise, many side effects will occur)
Clause 3:
1. Many functions return a constant value of const to avoid unreasonable operations on the returned value, such
Class {}
Const A operator * (const A & x, const A & y );
Without a const, it is possible to perform a meaningless value assignment operation on the function return value.