
这种特征如下:
代码实例如下:
struct Base { virtual void foo(); ; struct Derived0 : Base { virtual void foo() { /* do something */ } }; struct Derived1 : Base { virtual void foo() { throw std::exception{ "Not Implemented!" }; } }; void bar(Base &base) { /* do something */ base.foo(); } void baz() { Derived0 d0; bar(d0); /* do something */ } 1 linux40 OP 对了,还有一点要求,Derived0::foo 不能抛异常,比如没有 new 之类的。 |
2 linux40 OP kuso,人工顶一下。。。 |
3 secondwtq 2020-12-12 00:05:27 +08:00 我倒是觉得这个主题符合这种特征: https://en.wikipedia.org/wiki/XY_problem |