Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
C++

this Pointer in C++

Use this to refer to the current object inside members.

this Pointer in C++ — a practical guide to C++ this pointer with clear examples you can reuse in real projects.

C++ Tutorial Series (54/111). Prefer one article? Read the complete C++ tutorial.

Short description

Useful for disambiguation and fluent interfaces returning *this.

this

User& set_name(std::string name) {
    this->name_ = std::move(name);
    return *this;
}

Leave a reply

Your email address will not be published. Required fields are marked *