In C++, need help with operator overloading questions. Will thumbs up helpful re
ID: 3741658 • Letter: I
Question
In C++, need help with operator overloading questions. Will thumbs up helpful responses!
Answer the following questions. Each question will be graded from 0-4 and the overall score scaled to the maximum number of points. Print only no cursive - and use a pencil. A class, person, has private member variables, name (a string) and age (an int). Write the operator overloading functions (using class member functions, not friend functions) for>,, andsuch that these operators can be used to compare two people based on their ages. No prototypes are needed 1. 2. A class, circle, has private member variables, radius (a double) and area (a double). Write the operator overloading function (using class member functions, not friend functions) for such that adding two circles together will result in a circle that has the sum of the radi from both circles and the appropriate area. You may assume PI is a global constant that has been defined. No prototypes are needed 3. What operator is already defined for every class but can be overwritten? Why would one overwrite it?Explanation / Answer
Please find my answer ofr Q1.
Pelase repost others in separate post.
bool operator==(const peron& other) const
{
if (age == other.age)
return true;
else
return false;
}
bool operator>(const peron& other) const
{
if (age > other.age)
return true;
else
return false;
}
bool operator<(const peron& other) const
{
if (age < other.age)
return true;
else
return false;
}