Solved: 11 - Overloading
This commit is contained in:
@@ -2,10 +2,15 @@
|
|||||||
|
|
||||||
namespace functions {
|
namespace functions {
|
||||||
|
|
||||||
auto max_value(int a, int b) -> int { (void)a; (void)b; return 0; }
|
// Overloading based in parameter type
|
||||||
auto max_value(double a, double b) -> double { (void)a; (void)b; return 0.0; }
|
|
||||||
auto max_value(const std::string& a, const std::string& b) -> std::string { (void)a; (void)b; return {}; }
|
auto max_value(const int a, const int b) -> int { return a > b ? a : b; }
|
||||||
auto area(int side) -> int { (void)side; return 0; }
|
auto max_value(const double a, const double b) -> double { return a > b ? a : b; }
|
||||||
auto area(int width, int height) -> int { (void)width; (void)height; return 0; }
|
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
|
} // namespace functions
|
||||||
|
|||||||
Reference in New Issue
Block a user