Sample Class with Three Functions
Learn about overloaded functions in the C++ language.
We'll cover the following
Problem
Write a program that contains a class Sample
with three functions in it: fun1( )
, fun2( )
, and fun3( )
. All three functions receive an int
and a float
. fun1( )
receives them by value, fun2( )
by address, and fun3( )
by reference. All of them increment the int
and float
by 1.
-
Which function would be able to change the original value of
int
andfloat
? -
Can these functions be defined as overloaded functions?
Coding solution
Here is a solution to the problem above.
Get hands-on with 1200+ tech skills courses.