Talk:cpp/language/override

virtual and override
Do we want the functions in the derived class to have both "virtual" and "override"? It's true that only virtual functions can be marked as override, but I don't think that means that the presence of the "override" keyword means you have to also have "virtual" in the same declaration -- you could inherit "virtual" implicitly from a base class declaration. --Nate (talk) 15:15, 6 February 2014 (PST)
 * This page needs some work regardless, but I agree that a derived class that uses the override keyword doesn't need the virtual keyword - it's enforced by the former. In fact, it's better not to use it in this case, to catch the error of signature mismatch with the parent (when you thought you were overriding a virtual, but in fact declared an all-new virtual) --Cubbi (talk) 15:21, 6 February 2014 (PST)

Grand-derived class
Hi there, as usual my super-pedantic reading spotted something (cough I totally didn't run into this and search). What about 2nd-gen derived classes? Eg virt void f; in class A, B derives from A, C derives from B, now C has void f override in it, what does the standard say? Very little on this page talks about the *validity* of use of these. Please let me know! Alec (talk) 17:35, 10 August 2018 (PDT)

override specifier on member functions may need a clarification.
I read recently (yesterday) a blog post that used override on a destructor that had been declared in the parent class. Paring it down below for simplicity.

Regardless of the unnecessary specifier on, reading this page it is unclear that the  applies only to non-static member functions and never to special member functions. One has to go to the page to read it.

Should there be a clarification or perhaps an example?

ticotico (talk) 07:23, 10 September 2021 (PDT)


 * does apply to special member functions, such as in the example you provided. --Ybab321 (talk) 07:41, 10 September 2021 (PDT)
 * Understood, the question is whether there should be a clarification or an extended example. I could just add it, but I'm looking at a better alternative.--ticotico (talk) 09:58, 10 September 2021 (PDT)
 * Hi, there. I've extended the example a bit, mentioning the override for destructors. But probably, we still need more on this topic.)--Space Mission (talk) 14:58, 18 September 2021 (PDT)