dereferencing the pointer thissometimes a member


Dereferencing the Pointer this

Sometimes a member function requires to make a copy of the invoking instance so that it can change the copy without affecting the original instance. This can be done as follows :

                try_this temp(*this);

                try_this temp = *this ;

In OOP emphasis is on how the program shows data. It is a design concept with less emphasis on operational aspects of the program.  The primary concepts of OOP are implemented using class and objects. A class have data members as well as function members. The access specifiers control the access of data members. Only the public members of the class can access the data members declared in private section. Once class has been explained, many objects of that class can be declared. Data members of dissimilar objects of the same class occupy dissimilar memory area but function members of different objects of the same class share the similar set of functions. This is possible because of the internal pointer '*this' which keeps track of which function is invoked by which object.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: dereferencing the pointer thissometimes a member
Reference No:- TGS0309375

Expected delivery within 24 Hours