Question
Observe the following C++ code and answer the question.
class Traveller
{
long PNR;
char TName[20];
public :
Traveller() //Function 1
{
cout<<'Ready'<<end1;
}
void Book(long P,char N[])//Function 2
{
PNR = P; strcpy(TName, N);
}
void Print() //Function 3
{
cout<<PNR << TName <<end1;
}
~Traveller() //Function 4
{
cout<<'Booking cancelled!'<<end1;
}
};
Which function will be executed at }//Stops here? What is this function referred as?
Solution
Function 4
OR
~Traveller()
It is a Destructor function