LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Blogs > TheIndependentAquarius
User Name
Password

Notices


Pointers
Old

this pointer - C++

Posted 03-13-2012 at 11:10 AM by TheIndependentAquarius
Updated 03-13-2012 at 10:25 PM by TheIndependentAquarius

Quote:
The this pointer is a hidden pointer inside every class's non-static function which points to the class's particular object through which the concerned function is called.
Example:
Code:
class A
{
    private:
        int rollNumber;

    public:
	A (int rollNum)
	{
	    rollNumber = rollNum;
	}

	void setRollNumber (int rollNum)
	{
	    rollNumber = rollNum;
	}
};
...
Senior Member
Posted in C++, Pointers
Views 1093 Comments 0 TheIndependentAquarius is online now

  



All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration