LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > Aquarius_Girl
User Name
Password

Notices


Pointers
Old

this pointer - C++

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

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 Pointers, C++
Views 1791 Comments 0 Aquarius_Girl is offline

  



All times are GMT -5. The time now is 12:58 PM.

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
Open Source Consulting | Domain Registration