Analyzing Function Overloading as a Mechanism for Compile-Time Polymorphism in Modern C++
Abstract
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.
Fields of Study & Subjects
Logic
programming
and type systems
Parallel Computing and Optimization Techniques
Software Engineering Research
Publication details
- Journal / source
- Engineering Technology & Applied Science Research
- Volume
- 16
- Issue
- 1
- Pages
- 31004–31008
- Publication date
- 9 February 2026
- Language
- EN