In c++ Consider the following declaration: class strange { . . . }; Write a stat
ID: 3753463 • Letter: I
Question
In c++ Consider the following declaration:
class strange
{
.
.
.
};
Write a statement that shows the declaration in the class strange to overload the operator >>.
Write a statement that shows the declaration in the class strange to overload the operator =.
Write a statement that shows the declaration in the class strange to overload the binary operator + as a member function.
Write a statement that shows the declaration in the class strange to overload the operator == as a member function.
Write a statement that shows the declaration in the class strange to overload the post-increment operator ++ as a member function.
Explanation / Answer
class strange { // Write a statement that shows the declaration in the class strange to overload the operator >>. friend istream &operator>>(istream &in, strange &s); // Write a statement that shows the declaration in the class strange to overload the operator =. strange &operator=(const strange &s); // Write a statement that shows the declaration in the class strange to overload the binary operator + as a member function. strange operator+(const strange &s); // Write a statement that shows the declaration in the class strange to overload the operator == as a member function. bool operator==(const strange &s); // Write a statement that shows the declaration in the class strange to overload the post-increment operator ++ as a member function. strange &operator++(); };
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.