Describe "this" pointer?, C/C++ Programming

It is a pointer accessible only in the member functions of a struct, class or union type. It points to the object for which the member function is called. Static member functions do not have this pointer. While a nonstatic member function is called for an object, the address of the object is passed out as a hidden argument to the function. For instance, the following function call

myDate.setMonth( 3 );

may be interpreted this way:

setMonth( &myDate, 3 );

The object's address is accessible from in the member function as the pointer. This is legal, by unnecessary, to use this pointer while referring to members of the class.

 

Posted Date: 3/16/2013 2:58:28 AM | Location : United States







Related Discussions:- Describe "this" pointer?, Assignment Help, Ask Question on Describe "this" pointer?, Get Answer, Expert's Help, Describe "this" pointer? Discussions

Write discussion on Describe "this" pointer?
Your posts are moderated
Related Questions


2 flowcharts, pseudocode for each (at least 4 algorithms), and code for either a stack or a queuestion..

manupulates operator precidence

HWID Spoofer for Windows 7, 8 x64 Project Description: I want a simple program that will spoof my hardware id. I should be able to prepare the id to spoof to in the program a

Differentiate between the expression "++a" and "a++"? - With ++a, increment happens first on variable a, and resulting value is used. This is known as prefix increment. - Wi


The new and delete operators The C language has explained library functions- malloc() and free() for dynamic allocation and de-allocation of memory. C++ gives yet another appro

Define the Keywords of c language? C keeps a small set of keywords for its personal use. These keywords can't be used as identifiers in the program. Here is the list of keyword

Should I call a destructor explicitly on a local variable?