what is the function of 'this' operator ?

Answer Posted / madhu

'this' pointer is created when you create an object with
dynamic memory allocation. 'this' pointer will be created at
the time of object creation.
It holds the current object's address.
'this' cannot be used inside the static or a friend functions.

Is This Answer Correct ?    14 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do pointers exist?

755


What causes polymorphism?

671


What is a class in oop?

677


What is the important feature of inheritance?

725


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

2077






Why is encapsulation used?

659


What is for loop and its syntax?

678


Why do we use encapsulation in oops?

617


Which language is not a true object oriented programming language?

747


Can we create object of abstract class?

658


What is abstraction in oop with example?

738


Can you explain polymorphism?

674


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1806


What is the highest level of cohesion?

659


Describe these concepts: Polymorphism, Inheritance and Abstraction.

702