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
#question.to determine the area of a triangle,rectangle and trapezium

Rewrite the recursive bisection root finding function from lecture to be iterative (using a while loop). The function declaration should be root = bisectIter(f,a,b,tol). The input

program that counts the number of occurrences of the string in the n-th padovan string p(n)

Explain about the String Constants in c language? A collection of characters included within a pair of double quotes is treated as string constant. The character may be numbers

explain Storage management: free storage pool, garbage collection, compaction, boundary tag method; Hash tables and hashing functions

How to write a function template A function template should be written at the beginning of the program in the global area, or you may place it into a header file. All function

Define the System Oriented Data Files? System-oriented data files are further closely related to the computer's operating system than Stream- oriented data files and they are s

luminous jewel polishing necklace,c/c++ programming

Can any constructor throw an exception? How to handle error while the constructor fails?