在其他地方看到的两个题目 大家来讨论下
1.
构造函数中可不可以抛出异常?析构函数呢?
2. 这个题我实在记不清楚到底是怎么出的了,我自己参补成一个题,大家明白什么意思就行了。
C/C++ code
class B{public:
void f(int) const { }
void f(double) const { }
};
class D: public B{
public: void f(void*) const { }
};
D d;d.f(0); //调用那个函数?
d.f(1); //调用那个函数?
d.f(0.1); //调用那个函数?