In this lesson, I'm gonna take a look at another 
reason that it was good idea to declare and define 
the star operator, multiplication for fraction, as a
nonmember and star equal as a member. So, 
let's see what's going on here.
Okay, I'm gonna create two fractions: 'f' ¾ and 'g' 
a default. And I want to assign to 'g', 'f' times five 
or five times 'f'. Now this seems like a
natural thing to do. Multiply a fraction times an 
integer and it should be able to work.
Now, the problem or the consideration is, we've 
defined multiplication for a fraction times a 
fraction and five is not a fraction, it's an integer.
So, let's take a look at our definition. For the star 
operator, we notice it takes a fraction and a 
fraction.
So, what we're trying to do is, we're trying to call 
this function, star operator,
with a fraction and an integer meaning 'f' is gonna 
go in for the left-hand-side and five in for the right- 
hand-side. Problem is five is not a fraction.
Alright, it's got to be a fraction. Okay, we can 
solve the problem if we have a constructor
of the faction class that takes the single integer 
value
that is the same as this type here. A single 
instance of that integer value and it turns this
thing into a fraction. The numerator is going to be 
that value of n, the denominator will be one,
so five is going to get converted to 5/1. This is 
called a constructor for automatic conversion. It's 
a constructor that takes a single value of a
particular type and builds an object of the user 
defined type. What happens? When you call this 
operator (there is a star underneath there),
when you call this operator, the compiler 
recognizes that the five
that is supposed to be going in for this parameter 
can be automatically converted to a fraction type 
object using this constructor here. So, what
happens then? The constructor is called, 
temporary object is created, its numerator is five,
its denominator is one, so I've created this 
temporary object. 'f' then is multiplied in and
the result is assigned to 'g' in main. What about 
the second case? Same thing happens.
The operator star is calling for a fraction. This is 
an integer. The compiler recognizes that, calls 
the
constructor and changes five to a fraction and 
then it can carry out the multiplication.
Let's look at an alternative. Here we have a 
different star operator definition. It returns a 
fraction, its name is operator star, and it takes
an integer as an argument. Its parameter is an 
integer. So, I've overloaded the operator
even one more time. Is it good? And by the way 
I've put my old definition for the operator
star down here below so we can take a look at 
what's happening.
Well, in this case, yes. The five goes in here for 
right-hand-side, 'f' is the calling object and I get 
what I want.
Now the problem occurs when I have this 
situation. Can we solve this with another overload 
of the operator star?
And the answer is no because five is on the left-
hand-side of the operator,
it would have to be the calling object and that's 
not possible.
It cannot be calling object for a fraction class 
function. And, so this alternative is really no good.
This one works every time. This can be changed 
from an integer to a fraction, this can be changed 
from an integer to a fraction,
and I think we've got a really nice definition and 
we should not consider this overload.
Let's cross it out even more. Okay, and that's 
overloading operators.
