Top "Downcast" questions

Downcasting permits an object of a superclass type to be treated as an object of any subclass type.

Extend the existing C++ class

I'd like to add the extra functionality without changing the existing class. Say, class base{ public: int i; base(){i = 1;} …

c++ inheritance downcast
Downcasting a list of objects in C#

How can I downcast a list of objects so that each of the objects in the list is downcast to …

c# inheritance downcast
Downcasting using dynamic_cast returns null

I'm trying to cast a base class object to a derived class object with dynamic_cast, but dynamic_cast returns …

c++ dynamic-cast downcast
How can I do a safe downcast and prevent a ClassCastException

I have the following scenario: public class A { } public class B extends A { } public class C extends B { public void …

java casting downcast