LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 807 Comments 0 TheIndependentAquarius is offline

  



All times are GMT -5. The time now is 08:52 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration