#include<iostream>
using namespace std;
class Person {
public:
Person(int age) {
this->age = age;
}
int age;
};
void test(){
Person p(18);
cout << "p的年龄:" << p.age;
}
int main() {
test();
}
//this 指向被调用的成员函数所属的对象,也可以m_age
this指针
最新推荐文章于 2022-03-20 08:53:58 发布