سؤال

I have a base class Base, a somewhat more specialized class SpecializedBase derived from Base, and subclasses of the latter such as Derived.

I implement a virtual function in SpecialisedBase which is pure virtual in Base. How to be sure that this function is not overloaded in Derived?

هل كانت مفيدة؟

المحلول

yes, if you can use C++11, you can write your class like

    struct derived {
        virtual void f() final;
    };
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top