Firstly, the issue you are observing has absolutely nothing to do with member functions in general. Member functions can generally take arbitrary number of arguments of "same class" type. In your example you can declare
class Fraction
{
void foo(Fraction &f1, Fraction &f2, Fraction &f3, Fraction &f4) {}
...
};
without any problems. So, it is not clear why you decided to word your question as if it is about member functions in general.
Secondly, in your code it is really about the simple fact that you are trying to overload an operator. Operator syntax in C++ is fixed for most (but not all) operators. This immediately means that those operators whose syntax is fixed will have fixed number of parameters.
In your example, it is operator *
. It can be unary (one parameter) or binary (two parameters). When you overload this operator by a member function one parameter is already implied, so you can only add zero or one additional parameters (for unary *
and binary *
respectively). You, on the other hand, are trying to add two more parameters in additions to the implicit one. I.e. you are trying to define a ternary operator *
. This is not possible. There's no ternary *
operator in C++. And this is exactly what the compiler is telling you.