Problem 1807

Summary: Base class method hidden when deriving from G4EmSaturation
Product: Geant4 Reporter: Russ Terry <rterry>
Component: processes/electromagneticAssignee: Vladimir.Ivantchenko
Status: RESOLVED FIXED    
Severity: minor    
Priority: P5    
Version: 10.2   
Hardware: All   
OS: All   

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