, 这个增加的参数是 对象本身的指针 ;
在 Student 类中 , 定义了如下函数 :
// 成员函数 转为 全局函数 , 多了一个参数 Student* pThis 作为第一个参数
void...print 成员函数 , 转为 全局函数 , 转换后的代码为 :
// 将成员函数 void print()
// 转为 全局函数
void Student_print(Student* pThis)..., 将 两个 Student 对象相加 , 返回的是一个匿名对象 , 该匿名对象 是在 成员函数 中新创建的对象 ;
// 成员函数中, 将两个 Student 对象相加
// 全局函数 转为 成员函数...是指针指向的 自身对象
return *this;
}
// 成员函数 转为 全局函数 , 多了一个参数 Student* pThis 作为第一个参数
void print()
{...int height; // 身高
};
// 将成员函数 void print()
// 转为 全局函数
void Student_print(Student* pThis)
{
cout