Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gnucap:manual:tech:override [2022/11/25 01:39] (current)
felixs created
Line 1: Line 1:
 +Functions intended to override others should be marked as such. This will improve readability as well as catch typos and type
 +mismatch immediately.
  
 +It is unfortunate that its use is not required, as backwards compatibility is in the way. Note that GCC 5.1+ has added new warning suggest-override that you can pass as command line option -Wsuggest-override. Perhaps we should use it...
 +
 +<code>
 +  class A {
 +    virtual void x() {}
 +    virtual void y() {}
 +  };
 +
 +  class B : public A {
 +    void x() override {}      // good
 +    void y()          {}      // accepted???? override optional
 +    void x(int i) override {} // rejected, as intended
 +    void y(int i)          {} // accepted, is it intended or not?
 +    void x(double d) {}       // not sure what happens here.
 +    void y(double d) {}       // accepted, as it always was.
 +  };
 +</code>
gnucap/manual/tech/override.txt · Last modified: 2022/11/25 01:39 by felixs
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki