Given the class definition:
```
class A
public:
//constructors
// other members
private:
int x;
int y;
```
Give declarations of operator functions for each of the following ways to overload
operator + You must state where the declaration goes, whether within the class in the
public or private section or outside the class. The operator + may be overloaded
a) as friend function
b) as member function
c) as non-friend, non-member function
a) To overload operator+ friend function: place the declaration of the operator
function in the class prefixed by the keyword friend.
friend const A operator+(const A& lhs, const A& rhs);
Notice that there are two arguments, at least one of which has class type, as any
stand-alone operator overloading must. The implementation must also be available to
be compiled and linked to the user code.
b) : To overload operator+ as a member function: place the declaration of the operator
function in the public section of the class (if you want it to be available outside the
class)
const A operator+(const A& rhs);
Notice that there is one argument, which has class type, as any operator overloading
must. The implementation must also be available to be compiled and linked to the
user code.
c) To overload as non-friend, non-member function: Write the implementation of the operator function and put the declaration anywhere you plan to use the operator.const A operator+
```
(const A& lhs, const A& rhs);
```
You might also like to view...
A manual line break allows text to be moved to a new line while remaining part of the preceding paragraph
Indicate whether the statement is true or false
Director files that are locked for distribution have the .dir file extension.
Answer the following statement true (T) or false (F)