#include<bits/stdc++.h>
using namespace std;
class abc {
public:
int a = 45;
void sum() {
int s = 55;
cout << s + a << endl;
}
};
class xyz: public abc {
public: int b = 45;
int c = 54;
int d = 96;
int x = 8;
void show() {
cout << "xyz class" << endl;
}
};
int main() {
abc * ob;
xyz d;
ob = & d;
cout << sizeof( * ob) << endl; …Run Code Online (Sandbox Code Playgroud) 我是Java新手,我读到仅在编译时引发检查异常,即如果存在未处理或抛出的检查异常,程序将无法成功编译。如果有什么东西阻止编译器编译代码,那么我们可以删除它或以其他方式重新编码,这样问题就不会存在。
例如,如果我们试图打开系统中不存在的文件,我们不应该只是打开它。那么为什么需要处理/抛出这些异常呢?