#include <iostream>
#include <string.h>
using namespace std;
class base{
public:
base();
~base();
void show(); //声明一个 show 的接口
};
//添加类的名字::函数名
void base::show(){
cout << "show base" << endl;
}
base::base(){
cout << "base 的构造函数" << endl;
}
base::~base(){
cout << "base 的析构函数" << endl;
}
int main()
{
base a;
a.show();
}
类外编写的方法
最新推荐文章于 2025-08-04 19:56:00 发布