Message: B1 example problem Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None B1 example problem 

Forum: Particles
Date: 07 Apr, 2014
From: Lu, Wei <Lu, Wei>

I changed the G4ParticleGun class to the G4GeneralParticleSource. But when I compile it gives me such error message: error: member function 'GetParticleDefinition' not viable: 'this'
      argument has type 'const G4GeneralParticleSource', but function is not marked const
    runCondition += particleSource->GetParticleDefinition()->GetParticleName();
.../geant4.10.00/include/Geant4/G4GeneralParticleSource.hh:186:26: note: 'GetParticleDefinition' declared here
  G4ParticleDefinition * GetParticleDefinition () { return currentSource->GetParticleDefinition();} ;

I understand that is caused by accessing a non-constant member of a constant class object. But since it compiles fine for the G4ParticleGun class why not make the G4GeneralParticleSource the same. Do I have to overload the function in the G4GeneralParticleSource class or is there another way to access its non-constant member? Thanks.


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Agree: Re: B1 example problem   (Gumplinger Peter - 14 Apr, 2014)
 Add Message Add Message
to: "B1 example problem"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]