yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #02646
Re: ::go function
> And a pure curiosity question : has this "go" function to be always
> virtual ?
Yes in practice; it doesn't need to be declared as such (I think) since
it is declared virtual in one of the parent classes already and compiler
will pick that up.
Apart from that, if it were not virtual, you would end up calling ::go
of the base class, which just throws. (the base class is template for
Functor2D with some arguments, as you see with BoundFunctor, for
instance).
Note that in the future (post-0.30), though, the virtual function will
be replaced by a static function and there will be just virtual function
returning pointer to that static function. (More complicated but faster;
we do that with callbacks now, for instance)
> It seems it is the case in the ex I looked at, I was wondering if it
> should be a rule. I noticed to your manual the need of at least one
> virtual function per class, is this linked to that ?
::go will serve as that on virtual function. But it can be any other
function in general.
Cheers, Vaclav
References