The code is ill-formed. Virtual functions must have a unique "final overrider" that overrides all other instances of that function in its inheritance heirarchy. In this case neither Box::print nor Sphere::print override each other, so the condition is not met and the GeoDisc class is ill-formed.
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.