On Tue, 3 Oct 2000, Allan Rae wrote:
[ Adding virtual tags in derived classes ]
> The functions in the parent are virtual and usually when you define a
> derived class you make the derived functions virtual also (unless you
> don't want anyone deriving from your derived class). Adding virtual to
> these functions doesn't hurt but is a bit silly I admit since they are all
> now private in the derived classes.
If the methods were already defined as virtual in the base class there is
no real need to tag them virtual in the derived classes, as they are
already marked as virtual and stay virtual. The only reason to repeat the
tagging is a documentary one, i.e. to mention once again for the
programmers sake that this method is virtual.
If however the methods are newly defined and are set to private there is
no reason to make them virtual, they cannot be derived.
If they are not new methods but existing non-virtual-in-the-base-class
methods and are tagged virtual in the derived class I have no idea what
happens.
Anyhow from the discussion I understand its the first option, and it
stands that the methods are already virtual and tagging or not tagging
them as such in the derived classes needs no discussion on the merits of
virtual but on the documentation merits.
--
Baruch Even
http://techst02.technion.ac.il/~sbaruch/ (My Site)
http://www.redrival.com/jindor/ (My brothers AD&D site)
" Learn to laugh ... it's the path to true love! "
- The Angel in the movie Michael