Answer the questions (i) and (ii) after going through the following
class: class planet
{
char name[20];
char distance[20];
public:
planet() //Function 1
{
strcpy(name, "Venus");
strcpy(distance, "38 million km");
}
void display(char na[], char d[]) //Function 2
{
cout<< na<<"has"<<d<<"distance from Earth"<<endl;
}
planet(char na[],
char d[])//Function 3
{
strcpy(name, na);
strcpy(distance, d);
}
~planet() //Function 4
{
cout<<"Planetariurn time over!!!" <<endl;
}
};
(i) What is Function 1 referred as? When will it be executed?
(ii) Write suitable C++ statement to invoke Function 2.