72 532
Assignments Done
Successfully Done
In April 2019

Answer to Question #24197 in C++ for Nourh

Question #24197
What does it mean to overload a function? What is an advantage of doing so?
Expert's answer
Overloading a function means that you implement functions with the same name
but with different numbers of parameters and/or parameter types.

#include <stdio.h>

void print_string(const char* str)

void print_int(int n)
printf("%d", n);

Overloading allows you to execute different tasks by one function
according to the input parameters. On the other side it allows you
to organize the functions performing similar operations with objects
of different types (as in the code above).

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions