摘要: 函数名后加上override,表明该函数重写了父类的虚函数,同时编译器在编译时会进行检查是否正确重写。 建议重写时加上该关键字,方便检查及减少bug。 class A { public: virtual void f() { cout << "this is A" << endl; } }; cla 阅读全文
posted @ 2022-02-26 19:28 雪下牧原 阅读(210) 评论(0) 推荐(0)