Top "Downcast" questions

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

What is the difference between up-casting and down-casting with respect to class variable

What is the difference between up-casting and down-casting with respect to class variable? For example in the following program class …

java casting class-variables downcast upcasting
Convert base class to derived class

Is it possible in C# to explicitly convert a base class object to one of it's derived classes? Currently thinking …

c# inheritance casting downcast
Is it possible to assign a base class object to a derived class reference with an explicit typecast?

Is it possible to assign a base class object to a derived class reference with an explicit typecast in C#?. …

c# casting derived-class base-class downcast
downcast and upcast

I am new to C# (and OOP). When I have some code like the following: class Employee { // some code } class …

c# oop downcast upcasting
Explicit type casting example in Java

I have come across this example on http://www.javabeginner.com/learn-java/java-object-typecasting and in the part where it talks …

java casting downcast
In Objective-C, what is the equivalent of Java's "instanceof" keyword?

I would like to check whether an object (e.g. someObject) is assignable (cast-able) to a variable of another type (…

objective-c types casting equality downcast
C++ inheritance downcasting

I have my base class as follows: class point //concrete class { ... //implementation } class subpoint : public point //concrete class { ... //implementation } How …

c++ inheritance casting downcast
How does one downcast a std::shared_ptr?

Consider: struct SomethingThatsABase { virtual bool IsChildOne() const { return false; } virtual bool IsChildTwo() const { return false; } }; struct ChildOne : public SomethingThatsABase { virtual …

c++ c++11 shared-ptr downcast
Downcasting optionals in Swift: as? Type, or as! Type?

Given the following in Swift: var optionalString: String? let dict = NSDictionary() What is the practical difference between the following two …

swift optional downcast optional-variables
C++ cannot convert from base A to derived type B via virtual base A

I have three classes: class A {}; class B : virtual public A {}; class C : virtual public A {}; class D: public B, …

c++ casting downcast virtual-inheritance static-cast