next up previous
Next: Installation of the LEMuSR Up: Usefull C++ notions Previous: Header files and source

A bit more about user classes: the inheritance philosophy

A base class (a class from which other class derive) can present so-called virtual methods. That means that these methods can be re-written in a daughter class definition: in C++ language, virtual methods can be overloaded. Virtual methods are the key of Geant4 framework modularity: a large amount of Geant4 classes can be personalized by the user. The latter just has to rewrite the virtual methods, making sure to keep their exact name because they might be called at other places of the framework. As an example, the method in charge of builing the geometry must be called Construct(), and the messengers' method in charge of modifying parameters must have the name SetNewValue().



2005-12-21