首页 > 其他 > 详细

this指针

时间:2019-04-06 13:27:49      阅读:80      评论:0      收藏:0      [点我收藏+]

1.C++程序到C程序的翻译

class Test
{
public:
    int price;
    void setPrice(int p);
};

Test::setPrice(int p)
{
    price=p;
}
struct Test
{
    int price;
};

void setPrice(struct Test* this,int p)
{
    this->price=p;
}

2.其作用就是指向成员函数所作用的对象

3.特殊用法:return *this;返回当前操作的对象

4.静态成员函数中不能使用this指针

this指针

原文:https://www.cnblogs.com/-Asurada-/p/10661313.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!