Analyzing Function Overloading as a Mechanism for Compile-Time Polymorphism in Modern C++

Authors

  • Mohammad Bani Younes Computer Science Department, Information Technology, Ajloun National University, Ajloun, Jordan
  • Omer Abu Shqeer Computer Science Department, Information Technology, Amman Arab University, Amman, Jordan
  • Issa Alsmadi Data Science and Artificial Intelligence Department, Information Technology, Ajloun National University, Ajloun, Jordan
  • Njood Aljarrah Computer Science Department, Information Technology, Ajloun National University, Ajloun, Jordan
Volume: 16 | Issue: 1 | Pages: 31004-31008 | February 2026 | https://doi.org/10.48084/etasr.15409

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 concepts

Downloads

Download data is not yet available.

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

[1]
M. B. Younes, O. A. Shqeer, I. Alsmadi, and N. Aljarrah, “Analyzing Function Overloading as a Mechanism for Compile-Time Polymorphism in Modern C++”, Eng. Technol. Appl. Sci. Res., vol. 16, no. 1, pp. 31004–31008, Feb. 2026.

Metrics

Abstract Views: 93
PDF Downloads: 85

Metrics Information