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
A:BinaryHeap.h ------------ #ifndef BINARY_HEAP_H_ #define BINARY_HEAP_H_ #include "dsexceptions.h" #include "vector.h" // BinaryHeap class // CONSTRUCTION: wi

Program is to swap the two values which are enter by user: Program is to swap the two values which are enter by user through the function with values changed using pointers


obtain two numbers from thekey board,and determain and display(if either)is the larger of two numbers.

Relationship between an Array and Pointers. Consider the following. int arr[] = {0,1,2,3,4,5,6,7,8,9}; If we write arr , it is considered as the address of the first elem

main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is

limitation of linear array



What is the use of default constructor? - It's a constructor that doesn't accept any parameters. - If there is no user-defined constructor for a class, compiler declares a d