update dir

This commit is contained in:
light-city
2019-07-26 20:32:06 +08:00
parent b5c0b7c0aa
commit 5e33459d8b
13 changed files with 17 additions and 333 deletions

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#include<iostream>
#include<stdio.h>
using namespace std;
struct Base {
int v1;
// private: //error!
@@ -10,10 +10,14 @@ struct Base {
virtual void print(){
printf("%s\n","Base");
};
Base(){cout<<"Base construct"<<endl;};
virtual ~Base(){cout<<"Base deconstruct"<<endl;};
};
struct Derived:Base {
Derived(){cout<<"Derived construct"<<endl;};
virtual ~Derived(){cout<<"Derived deconstruct"<<endl;};
public:
int v2;
void print(){
@@ -24,5 +28,6 @@ struct Derived:Base {
int main() {
Base *b=new Derived();
b->print();
delete b;
return 0;
}