Class has no member?

Pages: 12
Awesome, I tried this and it doesn't work however:

 
  G4VUserPhysicsList::theParticleIterator->reset();


Do I have to declare it in the scope of the class 'myPhysListGeneral' as a member of 'G4VUserPhysicsList' first?
backwards. mplg is using g4vu. you would have to put in an instance of g4vu in mplg as well
Awesome, I think I will just try to inherit mplg in g4vu as that sounds easier.
yeah that would be the best sloution imo
However as g4vu is declared accordingly

 
class myPhysListGeneral : public G4VPhysicsConstructor


can I just append mplg to this? As in:

 
class myPhysListGeneral : public G4VPhysicsConstructor : public G4VUserPhysicsList 
it would be a comma, but i would just do this:

class myPhysListGeneral : G4VPhysicsConstructor, G4VUserPhysicsList
I dub thee awesome. Thanks for the amazing help!
no problem :) its what im here for. if you have any more questions dont be afraid to ask
One last question, it seems there is an ambiguity created when we inherit the members of g4vu in mplg as 'G4VPhysicsConstructor' and 'myPhysListGeneral' share a member called 'subInstanceManager'. What do you recommend as the best fix for this, making the inherited classes virtual as in:

 
class myPhysListGeneral : virtual G4VPhysicsConstructor, virtual G4VUserPhysicsList


or through specifying 'theParticleIterator' as a member of mplg as in:

 
G4VUserPhysicsList::theParticleIterator->reset();


or some iteration which specifies that theParticleIterator and its members are from g4vu. Neither of these seem to work for me.
Here is the compiler error for this problem to give evidence to my suspicions:
1
2
3
error: request for member 'subInstanceManager' is ambiguous
error: candidates are: G4VUPLManager G4VUserPhysicsList::subInstanceManager
G4VPCManager G4VPhysicsConstructor::subInstanceManager
If both of the classes define their own member with that name, I don't think virtual inheritance is going to help. I think you can just explicitly specify which parent class's version of the member you are referring to, but I may be wrong.
this->G4VUserPhysicsList::subInstanceManager
How do I use the this pointer in the vicinity of a pointer? As in:

1
2
3
4
  while( (*theParticleIterator)() ){
   ...
   ...
  } 
Just to clarify, 'theParticleIterator' contains the subInstanceManager and it would have to be this item that is declared as a member of G4VUserPhysicsList, I believe.
Last edited on
Zhuge was correct in his last post, the problem has been resolved.
Topic archived. No new replies allowed.
Pages: 12