Problem 1807 - Base class method hidden when deriving from G4EmSaturation
Summary: Base class method hidden when deriving from G4EmSaturation
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/electromagnetic (show other problems)
Version: 10.2
Hardware: All All
: P5 minor
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2015-12-16 20:54 CET by Russ Terry
Modified: 2016-01-15 10:05 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Russ Terry 2015-12-16 20:54:45 CET
The G4EmSaturation API allows for sub-classing to provide different parameterizations for scintillation photon yield. However, the G4EmSaturation base class includes two methods of the same name (VisibleEnergyDeposition) but with different prototypes. One is declared virtual and is intended to be overloaded while the other is not virtual and code comments specifically state that it should not be overloaded. In the C++ standard, overloading a method in a derived class hides all methods of the same name in the base class; so this API design does not work. Since the non-overloaded prototype is used within the G4Scintillation process, without a work around, compilation fails. Aapplication or toolkit developers can work around this issue by either re-implementing the required VisibleEnergyDeposition prototype in the sub-class (cut-and-paste) or including a 'using G4EmSaturation::VisibleEnergyDeposition' directive in the definition of the sub-class. However, an update to the API to eliminate the need for a work-around seems warranted.
Comment 1 Vladimir.Ivantchenko 2015-12-17 12:40:53 CET
Hello,

thank you very much for the report.

VI
Comment 2 Vladimir.Ivantchenko 2016-01-15 10:05:27 CET
Hello,

the problem is fixed and the fix will be available for the next patch to Geant4 10.2. We choose a simple solution to rename inline method.

VI