FUNCTIONS, CONSTRUCTOR, DESTRUCTOR & OVERLOADING QUESTIONS IN C++. (13)
Answer the questions (i) and (ii) after going through the following class:
class Vacancy
{
int VId;
char Dept[30];
public:
~ Vacancy() //Funciton1
{
cout<<"Vacancy Closed!!"endl;
}
Vacancy() //Funciton2
{
VId=101;
Dep="Computer";
}
void AboutYou() //Function3
{
cout<<VId<<":"<<Dept<<endl;
}
Vacancy(Vacancy &V) //Funciton4
{
VId=V.VId+15;
Dept=V.Dept+2;
}
};
(i) Which member function in the above definition of class Vacancy is called automatically, when the scope of an object gets over?
(ii) How many times the message "Vacancy Closed!!" will be displayed after executing the above C++ code?
class Vacancy
{
int VId;
char Dept[30];
public:
~ Vacancy() //Funciton1
{
cout<<"Vacancy Closed!!"endl;
}
Vacancy() //Funciton2
{
VId=101;
Dep="Computer";
}
void AboutYou() //Function3
{
cout<<VId<<":"<<Dept<<endl;
}
Vacancy(Vacancy &V) //Funciton4
{
VId=V.VId+15;
Dept=V.Dept+2;
}
};
(i) Which member function in the above definition of class Vacancy is called automatically, when the scope of an object gets over?
(ii) How many times the message "Vacancy Closed!!" will be displayed after executing the above C++ code?
No comments
Post your comments