Problem 1886

Summary: G4Cons should have a virtual destructor?
Product: Geant4 Reporter: Giuseppe Vacanti <gvacanti>
Component: geometry/solidsAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED WONTFIX    
Severity: minor    
Priority: P4    
Version: 10.1   
Hardware: All   
OS: All   

Description Giuseppe Vacanti 2016-09-05 17:58:38 CEST
I don't know if this is by design, but G4Cons does not have a virtual destructor and cannot be simply inherited from, or at least the lack of a virtual destructor suggests that I should not inherit from it.

I notice that other solids do have virtual destructors (G4Box does, for instance), so I suspect this is just an oversight,

Giuseppe
Comment 1 Gabriele Cosmo 2016-09-07 09:13:28 CEST
G4Cons as for all other concrete shapes is not supposed to act as base class for other classes. Indeed the "virtual" keyword should not be present, as it is not present for all the other virtual methods a G4 shape is supposed to implement.
Future revision of this code for C++11 will likely mark all concrete G4 shapes as 'final'.