Difference between revisions of "Cpp Coding Standards/CLSINIT/NoVirt"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m
Line 1: Line 1:
=== No Virtuals in Constructor or Destructor ===
+
=== No Virtuals in Constructor or Destructor (NoVirt) ===
Id: CLSINIT:'''NoVirt'''
+
[[../../CLSINIT#NoVirt|< Summary ]]
 
+
==== Summary ====
+
Don't call your own class' virtual functions in a constructor or destructor.
+
  
 
==== Explanation ====
 
==== Explanation ====
 
When an object is still in construction or already partly destructed, virtual functions often do not point to the intended override, but to another implementation of that function, or even nowhere. Exact behaviour may be compiler dependent.
 
When an object is still in construction or already partly destructed, virtual functions often do not point to the intended override, but to another implementation of that function, or even nowhere. Exact behaviour may be compiler dependent.

Revision as of 14:25, 12 April 2007

No Virtuals in Constructor or Destructor (NoVirt)

< Summary

Explanation

When an object is still in construction or already partly destructed, virtual functions often do not point to the intended override, but to another implementation of that function, or even nowhere. Exact behaviour may be compiler dependent.

Personal tools