मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता ११

Given the following C++ code, answer the following question. In Object-Oriented Programming, what is Function 1 referred to, and when does it get invoked/called? - Computer Science

Advertisements
Advertisements

प्रश्न

Given the following C++ code, answer the following question.

class TestMeOut
{
public:
~TestMeOut() //Function 1
{cout<<“Leaving the exam hall”<<endl;} TestMeOut() //Function 2
{cout<<“Appearing for exam”<<endl;}
void MyWork() //Function 3
{cout<<“Answering”<<endl;} };

In Object-Oriented Programming, what is Function 1 referred to, and when does it get invoked/called?

एका वाक्यात उत्तर

उत्तर

Function 1 is the ‘destructor’.
It is executed automatically when an object of the class TestMeOut goes out of scope.

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 14: Classes and objects - Evaluation - Section - C [पृष्ठ २४७]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 11 TN Board
पाठ 14 Classes and objects
Evaluation - Section - C | Q 4. (i) | पृष्ठ २४७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×