📄 05_02.cpp
字号:
// 05_02.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
class PlaneHead {
public:
PlaneHead() { cout << "construct Head." << endl; }
~PlaneHead(){ cout << "destroy Head." << endl; }
};
class PlaneBody {
public:
PlaneBody() { cout << "construct Body." << endl; }
~PlaneBody(){ cout << "destroy Body." << endl; }
};
class PlaneWing {
string name;
public:
PlaneWing(string str) {
name = str;
cout << "construct " << name << " Wing." << endl; }
~PlaneWing() { cout << "destroy " << name << " Wing." << endl;}
};
class Plane{
PlaneHead head;
PlaneBody body;
PlaneWing lWing, rWing;
public:
Plane():lWing("Left"), rWing("Right") {
cout << "construct Plane." << endl;
};
~Plane() { cout << "destroy Plane." << endl; }
};
int main(int argc, char* argv[])
{
Plane *p = new Plane();
delete p;
getch();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -