2026-08-11 17:40:36 +03:00
|
|
|
#include "overloading.hpp"
|
|
|
|
|
|
|
|
|
|
namespace functions {
|
|
|
|
|
|
2026-08-12 17:09:48 +03:00
|
|
|
// 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; }
|
2026-08-11 17:40:36 +03:00
|
|
|
|
|
|
|
|
} // namespace functions
|