the "this"

0 Gebran AL-maarry · September 10, 2016
I simply didn't understand any thing .....please help my

Post a Reply

Replies

Oldest  Newest  Rating
0 Scott Walker · September 10, 2016
put simply, it's a keyword that refers to the current object that you are working with
0 Denis Balaj · September 14, 2016
Every function that is defined within a class has a pointer called 'this'. (except for static function members that are part of the class, not part of any object).
The this pointer is used to identify the members of a specified object, for example obj1 has a function named try(), when you refer to data members of the class within this functions, the compiler should know for which object your referring to, so when u use a data member like 'unicorn' the compiler knows that you're referring to the unicorn data member of obj1 through the this pointer.
  • 1

C++

131,125 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator