Difference between revisions of "Cpp Coding Standards/Class Construction, Destruction and Copying"
From Apache OpenOffice Wiki
m |
|||
Line 2: | Line 2: | ||
Special issues of constructors, copying and destructors. | Special issues of constructors, copying and destructors. | ||
---- | ---- | ||
− | === | + | === Summary === |
==== NoVirtualsInCtorDtor ==== | ==== NoVirtualsInCtorDtor ==== | ||
Don't call your own class' virtual functions in a constructor or destructor. | Don't call your own class' virtual functions in a constructor or destructor. | ||
Line 20: | Line 20: | ||
* [[../HIERARCHY#RightDestructor | HIERARCHY:RightDestructor]] | * [[../HIERARCHY#RightDestructor | HIERARCHY:RightDestructor]] | ||
* [[../HIERARCHY#SafeCopying | HIERARCHY:SafeCopying]] | * [[../HIERARCHY#SafeCopying | HIERARCHY:SafeCopying]] | ||
+ | ---- | ||
+ | === Explanations === | ||
+ | |||
---- | ---- | ||
[[Category:Coding Standards]] | [[Category:Coding Standards]] |
Revision as of 18:07, 27 November 2006
Contents
Class Construction, Destruction and Copying
Special issues of constructors, copying and destructors.
Summary
NoVirtualsInCtorDtor
Don't call your own class' virtual functions in a constructor or destructor.
CtorInitSection
Use the constructors initialization section to initialize your members.
ObviousCopyability
Make it obvious if the class is intended to be copied. Forbid copying otherwise.
CopyAndAssignConsistently
Declare copy and assignment operators consistently – either both, or none.