0
Write statements that would call thge member Function1 and 4?
Class TEST { int time; public: TEST() //Function 1 { time=0; cout<<"hai"; } ~ TEST() //Function 2 { cout<<"hello"; } void exam() //Function 3 { cout<<"god bless you"; } TEST(int Duration) //Function 4 { time = Duration; cout<<"Exam starts"; } TEST(TEST&T) //Function5 { time = T.Durationn; cout<<"Exam finished"; } };
1 Resposta
+ 3
TEST T1; // Object T1 will get intialised with values from Function 1 (default constructor)
TEST T4(3); // The variable "time" present in Function 4 is initialised with value stored in duration, which is 3.