//Kind.h
#pragma once
#include<iostream>//为了更直观声明定义放一块了
using namespace std;
class Kind
{
public:
//默认构造函数
Kind() = default;
//拷贝构造函数
Kind(const Kind &kind){ cout << "我是拷贝构造函数,初始化且拷贝时调用" << endl; };
//重载拷贝赋值运算符
void operator = (const Kind &kind)
{
cout << "我是重载的拷贝赋值运算符函数,赋值且拷贝时调用" << endl;
}
};
///
//main.cpp
#include"kind.h"
int main()
{
cout << "the first" << endl;
Kind a = Kind();
cout << "the second " << endl;
Kind b = a;
b = a;
system("pause");
return 0;