Problem 1886 - G4Cons should have a virtual destructor?
Summary: G4Cons should have a virtual destructor?
Status: RESOLVED WONTFIX
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: 10.1
Hardware: All All
: P4 minor
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2016-09-05 17:58 CEST by Giuseppe Vacanti
Modified: 2016-09-07 09:13 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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'.