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
Operators The variables, which are declared and explained, are the operands, which are operated upon by the operators. Operators specify what operations are to be performed on

Program to Open a file in C++: int main() {                  char ch;                  ifstream f1 ("OLDFILE.TXT");                  ofstream f2 ("NEWFILE.TXT");

Here is a short program. It prints out the value of a variable "x". Ernie and Bert disagree about what will be printed: Ernie says, the value gets changed in "changeX" so it will p

Write a program to print a digital clock which displays the time for 2 hours .

Binary logical bit-wise operators  There are three logical bit-wise operators :                   &             and                 |              or

Although we can handle most I/O routines with getc and putc , there are file versions of fgets, fputs, fprintf and fscanf . The syntax is       fgets(stringname,n,filename);   Th

#q•Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference. Calculate the taxes

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Program is to read the characters from keyboard: Program is to read the characters from keyboard one by one stored in different files as upper constants, lower constants, othe