[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppThis
In this example, this can be left out:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppThis
(C++) this
Keyword used in a class. It is a pointer to the class itself.Example
class MyClass
{
int mValue;
public:
MyClass(const int& value) : mValue(value) { ; }
int getValue() const { return this->mValue; }
};
In this example, this can be left out:
class MyClass
{
int mValue;
public:
MyClass(const int& value) : mValue(value) { ; }
int getValue() const { return mValue; }
};
Code links
'this' links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
