Analyzing Function Overloading as a Mechanism for Compile-Time Polymorphism in Modern C++ - Younes, Mohammad Bani; Shqeer, Omer Abu; Alsmadi, Issa; Aljarrah, Njood (Engineering, Technology & Applied Science Research, 2026)
Polymorphism is a cornerstone of object-oriented programming that promotes code reuse and interface consistency. While runtime polymorphism through virtual functions is well understood, compile-time polymorphism via function overloading deserves deeper study in the context of modern C++. This paper provides a detailed analysis of function overloading as a mechanism for compile-time polymorphism. It explores overload-resolution rules, evaluates performance differences between static and dynamic dispatch, and integrates these findings with features introduced up to C++20. The benchmarking experiments are grounded in a computational geometry case study that compares dispatch mechanisms through area calculations for geometric shapes. Experimental results show that static dispatch through overloading outperforms virtual function calls by a factor of 3.2 in micro-benchmarks. The study concludes that combining overloading with modern C++ features enables high-performance, type-safe, and expressive code.