Objective C ++ Study Notes (Part Four: Item 18-25), effective18-25
Zookeeper
Recently, I finally carefully read javastvie C ++, and I was amazed at the power and charm of C ++. I will keep my recent reading experiences and Reading Notes here recently. It is necessary to find and use them.
When it comes to criticism:
Now, only the framework is listed, and it will be completed as soon as possible:
Part 1: Design and Declarations)
This section mainly describes the design principles and rules of classes, as well as some points that should be paid attention to when designing member commands and member functions. I personally feel that it is essential to design a class.
Article 18: Make the interface Easy to use correctly and misuse
Clause 19: design class is like design type
Clause 20: replace pass-by-reference-to-const with pass-by-value.
Clause 21: when an object must be returned, do not think about returning its reference
Clause 22: declare its member variables as private
Cla23: Native replaces the member function with non-member and non-friend.
Clause 24: If all parameters require type transfer, use the non-member function for this purpose.
Clause 25: Write A swap function that does not throw an exception.
Note: As there are many links between the terms, some of them are not suitable to be pulled out separately. This will be recorded in conjunction with other terms. If you have any questions, please contact us;