在 C++ 中,是否可以要求基类中的方法被其所有派生类覆盖而不使其成为纯虚拟方法?
#include <iostream>
using namespace std;
class BaseClass{
public:
int printStuff(){ //find some way to require all derived classes to override this method
cout << "Printing some stuff";
}
};
class DerivedClass: public BaseClass{
};
int main(){
cout << "Hello World!";
return 0;
}