Pregunta
Which of the following statement is true?
If a base class declares a pure virtual function, a
derived class must implement that function to
become a concrete class.
Referring to a derived-class object with a base-
class handle is dangerous.
A class is made abstract by declaring that class
virtual.
All virtual functions in an abstract base class must
be declared as pure virtual functions.
If a base class declares a pure virtual function, a
derived class must implement that function to
become a concrete class.
Referring to a derived-class object with a base-
class handle is dangerous.
A class is made abstract by declaring that class
virtual.
All virtual functions in an abstract base class must
be declared as pure virtual functions.
Ask by Powers Gonzalez. in the United States
Mar 14,2025
Solución de inteligencia artificial de Upstudy
Respuesta verificada por el tutor
Responder
The first statement is true: If a base class has a pure virtual function, the derived class must implement it to become concrete.
Solución

¡Inicia sesión para desbloquear respuestas gratis!
Una plataforma de aprendizaje en la que confían millones de estudiantes y profesores reales.

Respondido por UpStudy AI y revisado por un tutor profesional
Como
Bonus Knowledge
If a base class declares a pure virtual function, a derived class must implement that function to become a concrete class. This means that the derived class needs to provide an implementation for any pure virtual functions declared in its base class in order to be instantiated. Without this implementation, the derived class remains abstract, meaning you can’t create objects of that class.
Referring to a derived-class object with a base-class handle is a common practice and allows for polymorphism. However, developers should be cautious about accessing derived-class-specific properties or methods, as this may lead to runtime errors if the derived class has additional characteristics not present in the base class. Always ensure proper type checks or use dynamic_cast to ensure safe casting!

¡Prueba Premium ahora!
¡Prueba Premium y hazle a Thoth AI preguntas de matemáticas ilimitadas ahora!
Quizas mas tarde
Hazte Premium