From Apache OpenOffice Wiki
|
|
(7 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | Topic-Id: '''CLSINIT'''
| + | #REDIRECT [[Cpp_Coding_Standards/CLSINIT]] |
− | | + | |
− | Special issues of constructors, copying and destructors.
| + | |
− | ----
| + | |
− | === Summary ===
| + | |
− | | + | |
− | ==== <span id="NoVirt">No Virtual Calls in Constructor or Destructor</span> ====
| + | |
− | Don't call your own class' virtual functions in a constructor or destructor.
| + | |
− | | + | |
− | [[/NoVirt|Details]]
| + | |
− | ==== Constructor Initialization Section ====
| + | |
− | Use the constructors initialization section to initialize your members.
| + | |
− | | + | |
− | [[/InitSect|Details]]
| + | |
− | ==== Obvious Copyability ====
| + | |
− | Make it obvious, if the class is intended to be copied. Forbid copying otherwise.
| + | |
− | | + | |
− | [[/ObvCopy|Details]]
| + | |
− | | + | |
− | ==== Copy and Assign Consistently ====
| + | |
− | Declare copy and assignment operators consistently – either both, or none.
| + | |
− | | + | |
− | [[/CopyAssign|Details]]
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | ----
| + | |
− | === Related Rules ===
| + | |
− | * [[../Class Design#No Implicit Conversions| Class Design/No Implicit Conversions]]
| + | |
− | * [[../Error Handling#Which Functions Never Fail|Error Handling/Which Functions Never Fail]]
| + | |
− | * [[../Virtual Classes#Right Destructor|Virtual Classes/Right Destructor]]
| + | |
− | * [[../Virtual Classes#Safe Copying|Virtual Classes/Safe Copying]]
| + | |
− | | + | |
− | ----
| + | |
− | [[Category:Coding Standards]]
| + | |
Latest revision as of 10:44, 13 April 2007