1
codehz 2020-10-21 15:09:40 +08:00
有,只不过 final 关键字要加在类名的后面(
https://en.cppreference.com/w/cpp/language/final |
2
QBugHunter OP @codehz
谢谢 |
3
opensail 2020-10-21 16:31:21 +08:00
class A final{ /*将类标记为 final,禁止继承该类*/
public: virtual void func() final; /*使用 final 关键字修饰虚函数,禁止该虚函数重写*/ }; class B : public A { public: virtual void func() override; }; |