Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Removing redundant virtual from override function declaration #5444
Part of issue #5168.
@@ Coverage Diff @@ ## develop #5444 +/- ## ========================================== + Coverage 88.09% 88.1% +<.01% ========================================== Files 308 308 Lines 31247 31182 -65 Branches 3751 3745 -6 ========================================== - Hits 27528 27473 -55 + Misses 2465 2455 -10 Partials 1254 1254
I was wondering what happens if a subclass so far used
Did a tiny experiment and it seems everything is alright, at least on my computer:
@axic Yeah, cppreference seems to structure it like this, from what I've researched, it seems like the proper way to format it - virtual in base class, override in derived. Although of course, I'd hate to accidentally add in some strange behaviour. Still not sure what the worsened code coverage is all about.
Indeed even without repeating
virtual in a derived class, the function will still be implicitly
virtual and can still be overridden in another class deriving from the derived class, so this is OK.
However, I spotted one
virtual that was in fact virtual inheritance and not a redundant virtual in an override, so we have to keep that one. Apart from that this looks fine.