Asked by joseph onuorah on May 13, 2024

verifed

Verified

Assigning an object of a derived class to a variable of a base class is called:

A) static binding
B) dynamic binding
C) upcasting
D) downcasting

Upcasting

The casting of a derived class object to a base class object, which typically does not require an explicit type casting.

Derived Class

In object-oriented programming, a class that extends functionality from another class, acquiring its attributes and methods with the possibility of introducing new features and overwriting existing ones.

Base Class

The class from which other classes inherit properties and methods, often referred to as the superclass.

  • Understand the process and implications of upcasting and downcasting in object orientation.
verifed

Verified Answer

EO
Emmanuelle OrtizMay 19, 2024
Final Answer :
C
Explanation :
Assigning an object of a derived class to a variable of a base class is called upcasting. This is because the object of the derived class can be treated as if it were of the base class. Upcasting is a type of static binding, where the binding between the variable and the object happens at compile-time instead of run-time. Dynamic binding, on the other hand, is when the binding between the method call and the method to be invoked happens at run-time. Downcasting is the opposite of upcasting, where an object of a base class is assigned to a variable of a derived class.