Identify the errors in the following member operator function-00982
This subjective question is related to the book/course vu cs605 Software EngineeringII. It can also be found in vu cs605 Mid Term Solved Past Paper No. 1.
Question 1: Identify the errors in the following member operator function and also correct them.
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
}
math temp;
temp = m;
temp.number= number * number;
return temp.number;
}
Page. No. 9/15
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
}
Answer:
The errors are in the arguments of the member operation function and also in the body of operator member function. Correct function should be
math *operator (math *m) {math temp;
temp = m;
temp.number= number * number;
return temp.number;
}
Page. No. 9/15