FUNCTIONS, CONSTRUCTOR, DESTRUCTOR & OVERLOADING QUESTIONS IN C++. (15)
Answer the questions (i) and (ii) after going through the following class:
class Cricket
{
int Time;
public:
Cricket() //Funciton1
{
Time=0;
cout<<"Cricket"endl;
}
void Details() //Funciton2
{
cout<<"Inter school Match"endl;
}
Cricket(int Duration) //Function3
{
Time=Duration;
cout<<"Another cricket begins now"endl;
}
Cricket(Cricket &C) //Funciton4
{
Time=C.Time;
cout<<"like previous Match"endl;
}
};
(i) Which categroy of constructor, Funciton4 belongs to and what is the purpose of using it?
(ii) Write statements that would call the member Funciton1 and Funciton3.
class Cricket
{
int Time;
public:
Cricket() //Funciton1
{
Time=0;
cout<<"Cricket"endl;
}
void Details() //Funciton2
{
cout<<"Inter school Match"endl;
}
Cricket(int Duration) //Function3
{
Time=Duration;
cout<<"Another cricket begins now"endl;
}
Cricket(Cricket &C) //Funciton4
{
Time=C.Time;
cout<<"like previous Match"endl;
}
};
(i) Which categroy of constructor, Funciton4 belongs to and what is the purpose of using it?
(ii) Write statements that would call the member Funciton1 and Funciton3.
No comments
Post your comments