An Alternative to Virtual Functions in Modern C++. Application in Training
Authors:
Ivaylo
Donchev
St. Cyril and St. Methodius University of Veliko Tarnovo, Bulgaria
Pages:
144-
159
DOI: https://doi.org/10.54664/KPDP6631
Abstract:
Although virtual functions are a convenient object-oriented programming mechanism, they come
at a cost in terms of additional computational resources. Additionally, the vulnerabilities related to the implementation of this mechanism have long been known. On the other hand, domains in which C++ is used assume high
code efficiency and uncompromising reliability and safety. In this study, problems related to virtual functions, optimization and vulnerability mitigation techniques, as well as alternative methods are analyzed. A new non-virtual
approach has been developed, based on the modern language features described in the C++20 and C++23 standards. This approach can improve performance and security while maintaining flexibility in software development.
Aspects of integration of the approach into student training are discussed.
Keywords:
virtual function, type erasure, vtable, concept, variadic templates, metaprogramming, education.
Download
139 downloads since 9.12.2025 г.
NA