Rabu, 15 Februari 2017

What is the use of this pointer in C++ programming

For every object in C++, there is an implicit pointer called this pointer. It is a constant pointer which always points to the current object. Uses of this pointer are as follows: When data member names and function argument names are same, this pointer can be used to distinguish a data member by writing this->member-name. It can be used inside a member function to return the current object by address by writing return *this.   The this pointer cannot be used along with static functions as static functions are not part of any object. Following program demonstrates the use of

The post What is the use of this pointer in C++ programming appeared first on Coding Security.


What is the use of this pointer in C++ programming
read more

Tidak ada komentar:

Posting Komentar