It is highly unusual to put visitor functions in the element class for two reasons
- It means each visitor's code is dispersed. General rule of thumb is that a class' code is in one place.
- The entire purpose of Visitor is to decouple the algorithms for the elements. There is no reason to recouple them by putting them in the same .cpp