我正在攻读面向对象编程的测试,我想知道是否有任何案例,考虑到以下代码:
try {
do something
} catch (someException e) {
} finally {
do something
}
Run Code Online (Sandbox Code Playgroud)
该finally块不会执行?
嘿! 看看下面的例子..它几乎是一些cpp书的复制粘贴.我无法理解为什么不编译(在Windows下).它说:
'<<' : no operator found which takes a right-hand operand of type 'div_t' (or there is no acceptable conversion)
Run Code Online (Sandbox Code Playgroud)
这是一个例子:
#include <iostream>
template <class T>
T div(T a, T b) {
T result = a/b;
return result;
}
int main() {
int a = 5;
int b = 3;
std::cout << "INT " << div(a,b) << std::endl; //this line output the error
return 0;
}
Run Code Online (Sandbox Code Playgroud)
谢谢!!