ch11cperson.h

来自「此例子是学习C++的好东西」· C头文件 代码 · 共 24 行

H
24
字号
//Program 11-7 CPerson   CPerson base class

//File: CPerson.h

#ifndef _CH11CPERSON_H
#define _CH11CPERSON_H
#include <iostream>
#include <string>

using namespace std;

class CPerson
{
protected:
	string name;
	int age;
public:
	CPerson(string n, int a);
	CPerson(){ cout << "\nIn the do-nothing CPerson constructor \n"; };
	void WritePerson(){	cout <<  name << " is " << age << " years old.  \n"; }
	~CPerson() { cout << "\nDestructing CPerson object \n"; }
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?