Class foo {
public:
static std::string make(std::string a) { .. }
}
我想打富的抽象基类,但显然使不能在这个抽象的基地使用的情况下,由于虚拟功能无法是静态的。
像这样
Class foo {
public:
static virtual std::string make (std::string) = 0; //error this cannot be done
}
Class fooImpl: foo{
public:
std::string make(std::string a) { ..}
}
正在在抽象类中的方法非静态的或已派生类具有静态方法从设计的角度来看一个不错的办法。
但是,这并没有帮助使静态功能虚拟... – Patrick 2008-12-24 12:48:16