guys I know this question is very basic but I\'ve met in few publications (websites, books) different style of override virtual function. What I mean is: if I have base clas
This is purely a matter of taste. Some weak arguments can be made back and forth as to the self-documentation value of some styles versus the non-redundancy of others.
I personally use both styles: virtual means that the method can be overridden.
So we have two cases:
virtual keywordTemplate Pattern), then do not use the virtual keywordI guess it's yet another way of (ab?)using the keyword.
It is not necessary to add the virtual keyword to a method you override in a subclass as this qualifier can not be removed by omitting it in subclass declarations.
It is however good practise to repeat the virtual keyword as it documents which derived functions are virtual in the base class.
This is also recommended by the 'High Integrity C++ Coding Standard Manual'.
which is linked in the C++ FAQ.