I am currently doing a programming project where I have declared 2 objects of a class called Statistician. The objects are called s1 and s2. Each object uses a function to read in 3 values of type double into the sequence. Then, for each sequence I compute and print results for: length of sequence, last number entered, sum of sequence, arithmetic mean, smallest number, largest number (each computation has it's own function, which returns the value.
I am currently trying to overload the + operator so that I can add both sequences (each with 3 numbers) together, into a 3rd class object which will have all 6 values. Then, I hope to be able to perform the computations I listed above on this new class. How do I overload the + operator to perform this task?
What I have so far:
Statistician operator +(const Statistician&)
{
//Postcondition: the sum of all numbers in sequences s1 and s2 is returned
}
Also, I have been told that I should make this a friend function to have access to variables I declared in the class. How do I declare the friend function correctly so it has access to do this?