Analyzing Function Overloading as a Mechanism for Compile-Time Polymorphism in Modern C++
Received: 8 October 2025 | Revised: 19 October 2025 and 8 November 2025 | Accepted: 10 November 2025 | Online: 9 February 2026
Corresponding author: Mohammad Bani Younes
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.
Keywords:
C , compile-time polymorphism, function overloading, name mangling, static dispatch, type safety, software performance, C 20 conceptsDownloads
References
A. Alexandrescu, Modern C++ Design: Generic Programming and Design Patterns Applied. Boston, MA, USA: Addison-Wesley, 2001.
B. Stroustrup, The C++ Programming Language, 4th ed. Boston, MA, USA: Addison-Wesley, 2013.
S. B. Lippman, Inside the C++ Object Model. Boston, MA, USA: Addison-Wesley, 1996.
S. Meyers, Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14. Sebastopol, CA, USA: O'Reilly Media, 2014.
N. M. Josuttis, The C++ Standard Library: A Tutorial and Reference, 2nd ed. Boston, MA, USA: Addison-Wesley, 2012.
A. Jia et al., "1-to-1 or 1-to-n? Investigating the Effect of Function Inlining on Binary Similarity Analysis," ACM Transactions on Software Engineering and Methodology, vol. 32, no. 4, May 2023, Art. no. 87. DOI: https://doi.org/10.1145/3561385
D. Vandevoorde, N. Josuttis, and D. Gregor, C++ Templates: The Complete Guide, 2nd ed. Boston, MA, USA: Addison-Wesley, 2017.
Programming languages — C++, ISO/IEC 14882, 2024.
"Itanium C++ ABI." GitHub. https://itanium-cxx-abi.github.io/cxx-abi/abi.html.
K. Driesen, "Measurement of Virtual Function Call Overhead on Modern Processors," in Efficient Polymorphic Calls, Boston, MA, USA: Springer US, 2001, pp. 69–96. DOI: https://doi.org/10.1007/978-1-4615-1681-1_6
A. Fertig, Programming with C++20: Concepts, Coroutines, Ranges, and more. Frankenhardt, Germany: Fertig Publications, 2024.
B. Stroustrup, "Concept-Based Generic Programming in C++." arXiv, Oct. 09, 2025.
Z. Porkoláb, J. Mihalicza, and Á. Sipos, "Debugging C++ template metaprograms," in Proceedings of the 5th international conference on Generative programming and component engineering, Portland, OR, USA, 2006, pp. 255–264. DOI: https://doi.org/10.1145/1173706.1173746
B. Mohr et al., "Parallel/High-Performance Object-Oriented Scientific Computing," in Object-Oriented Technology ECOOP’99 Workshop Reader, Lisbon, Portugal, 1999, pp. 222–239. DOI: https://doi.org/10.1007/3-540-46589-8_13
C. Wang and D. Hou, "An Empirical Study of Function Overloading in C++," in 2008 Eighth IEEE International Working Conference on Source Code Analysis and Manipulation, Beijing, China, 2008, pp. 47–56. DOI: https://doi.org/10.1109/SCAM.2008.25
L. T. C. Melo, R. G. Ribeiro, B. C. F. Guimarães, and F. M. Q. Pereira, "Type Inference for C: Applications to the Static Analysis of Incomplete Programs," ACM Transactions on Programming Languages and Systems, vol. 42, no. 3, Nov. 2020, Art. no. 15. DOI: https://doi.org/10.1145/3421472
"C++ ABI for Itanium: Exception Handling." Linuxfoundation. https://refspecs.linuxfoundation.org/abi-eh-1.22.html.
L. Chen, D. Wu, W. Ma, Y. Zhou, B. Xu, and H. Leung, "How C++ Templates Are Used for Generic Programming: An Empirical Study on 50 Open Source Systems," ACM Transactions on Software Engineering and Methodology, vol. 29, no. 1, Jan. 2020, Art. no. 3. DOI: https://doi.org/10.1145/3356579
M. Bezbaruah, S. Dhakulkar, P. Pandey, H. P, S. A. Kumar, and S. D. Sudarsan, "Comparative Analysis of GCC and LLVM for Performance Optimization on Aarch64," in 2024 IEEE High Performance Extreme Computing Conference, Wakefield, MA, USA, 2024, pp. 1–6. DOI: https://doi.org/10.1109/HPEC62836.2024.10938451
F. Zhang, N. A. S. Abdullah, and M. M. Rosli, "Analysis of Critical Success Factors of Agile Software Projects based on the Fuzzy Delphi Method," Engineering, Technology & Applied Science Research, vol. 15, no. 1, pp. 19424–19433, Feb. 2025. DOI: https://doi.org/10.48084/etasr.9151
Downloads
How to Cite
License
Copyright (c) 2025 Mohammad Bani Younes, Omer Abu Shqeer, Issa Alsmadi, Njood Aljarrah

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.
