Virtual Function (C++)

A virtual function is a member function marked with the virtual keyword so that the correct version runs based on the object's actual type at runtime. This…