16 September 2016
Red slips? We'll turn them green for you. Profits go to your bank card first — we'll split them afterward. No upfront payment, no account access required. 🟢 WhatsApp: 85254981192 ⚪ Telegram: @kkk437
16 September 2016


class CFoo final { //--- class body }; class CBar : public CFoo { //--- class body };When attempting to inherit from a class with the 'final' modifier as shown above, the compiler displays an error:
class CFoo { void virtual func(int x) const { } };The method is overridden in the inherited class:
class CBar : public CFoo { void func(short x) { } };But the argument type is mistakenly changed from 'int' to 'short'. In fact, the method overload instead of overriding is performed in that case. While acting according to the overloaded function definition algorithm, the compiler may in some cases select a method defined in the base class instead of an overridden one.
class CBar : public CFoo { void func(short x) override { } };If the method signature is changed during the overriding process, the compiler cannot find the method with the same signature in the parent class issuing the compilation error:
class CFoo { void virtual func(int x) final { } }; class CBar : public CFoo { void func(int) { } };When attempting to override a method with the 'final' modifier as shown above, the compiler displays an error:
Updated documentation.