When is the downcasting used?

Đức Lưu

New member
When is the downcasting used?
A. To separate inherited class from base class
B. To write a more complex code
C. To compare two objects
D. To disable one class in inheritance
 
Answer: c
Explanation: The downcasting can be used whenever there is a need to compare one object to another. Equals() function can be used to compare whether the objects were of same age. We can use getClass() function too.
 

Tìm kiếm

Back
Top