02B-2016
CBSE12D-2016
Problem Statement - 02B
Observe the following C++ code and answer the questions (i) and (ii) :
class Traveller { long PNR; char TName[20]; public : Traveller() //Function 1 {cout<<"Ready"<<endl;} void Book(long P,char N[]) //Function 2 {PNR = P; strcpy(TName, N);} void Print() //Function 3 {cout<<PNR << TName <<endl;} ~Traveller() //Function 4 {cout<<"Booking cancelled!"<<endl;} };
(i) Fill in the blank statements in Line 1 and Line 2 to execute Function 2 and Function 3 respectively in the following code:
v oid main{) { Traveller T; _____________ //Line 1 _____________ //Line 2 }//Stops here
(ii) Which function will be executed at }//Stops here? What is this
function referred as ?
Solution
CSKC| Created: 4-Jan-2019 | Updated: 5-Jan-2019|CBSE12D-2015