I've seen references on the web to an "override" keyword that allows the compiler to check method signatures are the same where intended, ie. instead of creating a new virtual function when a subclasses override method no longer matches the superclass. (Microsoft compilers.) This would be a very good api enhancement. http://msdn.microsoft.com/en-us/library/41w3sh1c.aspx eg.: struct I1 { virtual void f(); }; struct X : public I1 { virtual void f() override {} };
(In reply to comment #0) This keyword seems to be Microsoft specific, right?
I would also appreciate if gcc supported the override keyword. Consider adding the keyword 'sealed' and perhaps even 'abstract' too. Johan Torp / www.johantorp.com
I should mention that another option (that is also microsoft specific) is available: class Base { virtual void vfunc(); } class Derived { // qualify using Base:: to say that you are overiding // if Base doesn't have a matching vfunc, it is an error void Base::vfunc(); }; See http://www.cpptalk.net/3-vt23515.html?postdays=0&postorder=asc&start=30 Johan Torp / www.johantorp.com
*** This bug has been marked as a duplicate of 17920 ***