Files
cpp-course/modules/03_functions/src/overloading.cpp
T

17 lines
553 B
C++

#include "overloading.hpp"
namespace functions {
// Overloading based in parameter type
auto max_value(const int a, const int b) -> int { return a > b ? a : b; }
auto max_value(const double a, const double b) -> double { return a > b ? a : b; }
auto max_value(const std::string& a, const std::string& b) -> std::string { return a > b ? a : b; }
// Overloading based in parameter count
auto area(const int side) -> int { return side * side; }
auto area(const int width, const int height) -> int { return width * height; }
} // namespace functions