Home / MCQ Bank / Computer
Computer Constructors And Destructors In C Plus Plus

In C++, what is the purpose of the 'this' pointer in a class member function?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option A • It points to the memory location of the current object instance

Related Computer Questions

Which device is required to establish an internet connection on a computer? In C language, FILE is of which data type? What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; void func(int a, int b) { if(b < 1){ throw b; } else{ cout<<"Product of "<<a<<" and "<<b<<" is: "<<a*b<<endl; } } int main() { try { try { func(5,-1); } catch(int b) { if(b==0) throw "value of b is zero\n"; else throw "value of b is less than zero\n"; } } catch(const char* e) { cout<<e; } } What will be the output of the following C++ code? #include <iostream> using namespace std; template<class T = float, int i = 5> class A { public: A(); int value; }; template<> class A<> { public: A(); }; template<> class A<double, 10> { public: A(); }; template<class T, int i> A<T, i>::A() : value(i) { cout << value; } A<>::A() { cout << "default"; } A<double, 10>::A() { cout << "10" << endl; } int main() { A<int, 6> x; A<> y; A<double, 10> z; } The arranging of data in a logical sequence is called