I introduce function signatures in the first lecture of this section.
And I said the whole thing is the function signatures.
If we have something like Prince
X the whole part of this is called the font function signature.
And one thing we can do with functions is something called overloading.
So if you have this print function it takes in a integer x You could also have another function called
print.
But we can actually change the argument type from Char in this case and we can actually have it also
print a char instead.
It's kind of define this and see what it mean here.
Crunch X in our induce Ouch doing integer
x secreted for an Ruskin to define our other print function that prints the characters.
CEO CH Jean care jare
C endl So notice that the function names are the same but the arguments are different.
So C++ world shoes the proper print function based on the signature.
And that's why signatures are so important.
And specifically it chooses it based on the arguments that it has.
So this is called function overloading.
So we're overloading the print function with more functionality sort.
So if you want to overload a function as a function of the same name the arguments must differ from
each other by the types and or the number of arguments.
Let's actually say print.
It's wondred in print.
The character they say and notice that the compiler doesn't give us any issues.
So if you run this says putting integer one hundred and printing character a so called both of these
functions but our calls Look effectively the same they're the same name but the arguments are different.
OK so the arguments are really what chooses what function gets called so C++ can kind of figure it out
itself.
And we can also have say another print function print each have an X in char see this and that's fine
it
in literally just copy this whole thing again.
So here's Whoa
in we'll call it here print in-seat 200 and B.
And notice that calls are want K says 200 and be called this one.
So the the arguments differ by how many there are.
So it doesnt get confused by this first one because our first one here.
Here it doesnt get confused because this has an integer x and a character C K so function overloading
is really one of those conveniences for when functionality really should be named the same but differ
in the parameters k.
So I tend not to use this all the time but it is quite nice when it's needed.
So in the next lecture we'll be going over default printers.