Objective C ++ Study Notes (Part Two: Item 5-12), effective5-12
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 essential to find and use them. If you sum up any mistakes, please criticize and correct them:
Now, only the framework is listed, and it will be completed as soon as possible:
Part 1: constructor/destructor/value assignment
I personally think this is a difficult part of C ++, and it is also a deep part of C ++. When I first started reading, I may not understand it in some places, the best way is to implement programming while reading and thinking about its essence with your heart!
Clause 5: Understand the functions that C ++ silently writes and calls
Clause 6: if you do not want to use the function automatically generated by the compiler, you should explicitly reject it.
Clause 7: declare virtual destructor for the polymorphism base class
Clause 8: do not escape exceptions from destructor
Clause 9: virtual functions are never called during constructor and destructor.
Clause 10: Make operator = return a reference to * this
Clause 11: handle self-assignment in operator =
Clause 12: Do not forget every component of an object when copying it.
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;