hallo,
ich sollte diese klasse implementieren:
Nur ist mir nicht ganz klar, was der unterschied der friend und non-member function (operator ==) zu den normalen member function in diesem header file ist bzw. wie ich diese im implmentation file dann definieren muss...? ![Confused :confused: :confused:](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f615.png)
kann mir hier jemand weiterhelfen?
lg matti
ich sollte diese klasse implementieren:
Code:
namespace test_1
{
class statistician
{
public:
// CONSTRUCTOR
statistician( );
// MODIFICATION MEMBER FUNCTIONS
void next(double r);
void reset( );
// CONSTANT MEMBER FUNCTIONS
int length( ) const;
double sum( ) const;
double mean( ) const;
double minimum( ) const;
double maximum( ) const;
// FRIEND FUNCTIONS
friend statistician operator +
(const statistician & s1, const statistician & s2);
friend statistician operator *
(double scale, const statistician & s);
private:
int count; // How many numbers in the sequence
double total; // The sum of all the numbers in the sequence
double tinyest; // The smallest number in the sequence
double largest; // The largest number in the sequence
};
// NON-MEMBER functions for the statistician class
bool operator ==(const statistician& s1, const statistician& s2);
}
![Confused :confused: :confused:](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f615.png)
kann mir hier jemand weiterhelfen?
lg matti