13年题。

This commit is contained in:
unlockable
2023-06-02 00:03:58 +08:00
parent 955977fef2
commit 9cecf352c2
11 changed files with 401 additions and 0 deletions

31
OOP/13Exam/3.3.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include <iostream>
using namespace std;
class Base {
private:
char c;
public:
Base(char n): c(n) {}
virtual ~Base() {
cout << c;
}
};
class Der:public Base {
private:
char c;
public:
Der(char n):Base(n + 1), c(n) {}
~Der(){
cout << c;
}
};
int main() {
Der('X');
return 0;
}
/*
XY
*/