Asked by Jasmine Abunaim on Jun 18, 2024
Verified
Downcasting should be used only in situations where it makes sense.
Downcasting
Converting a reference of a parent class to a reference of a child class, requiring explicit type-casting in languages like Java.
- Comprehend the procedure and consequences of upcasting and downcasting in object-oriented programming.
Verified Answer
VC
vanessa cisnerosJun 21, 2024
Final Answer :
True
Explanation :
Downcasting should only be used when we need to access specific methods or fields of a subclass that are not available in the superclass. It should not be used just for the sake of using it, as it can lead to runtime errors and violate good programming practices.
Learning Objectives
- Comprehend the procedure and consequences of upcasting and downcasting in object-oriented programming.
Related questions
Assigning an Object of an Ancestor Class to a Descendent ...
Assigning an Object of a Derived Class to a Variable ...
Orientation Tolerances, When Applied to Plane Surfaces, Control Flatness If ...
A Tolerance of Form or Orientation May Be Specified Where ...
The Shape of an Object and Its ____________________ Influence the ...