GeeksforGeeks » C/C++ Programming Questions

C++ this pointer

(2 posts)

Tags:

  1. Rick
    guest
    Posted 1 year ago #

    When do we have to use this pointer explicitly in our programs?

  2. Misraji
    Member
    Posted 1 year ago #

    Example 1:

    class base {
    int value;

    public:
    void set_value(int value)
    {
    this->value = value;
    }
    };

    Example 2:

    Object&
    Object::func (){
    {
    // Some processing
    return *this;
    }

    ~Ashish


Reply

You must log in to post.

RSS feed for this topic