By +Biscuits Brown,
By Usama Jawad96 · Posted
By wrack · Posted
By +Cryton · Posted
By xMorpheousx416 · Posted
We rely on ads to keep creating quality content for you to enjoy for free.
Please support our site by disabling your ad blocker.
Continue without supporting us
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
Ch33f
Here there are 2 classes Employee(base class) and Manager(sub class) Manager inherits from Employee.I have added 2 Interfaces IName and ISalary so that i can downcast.
Here are the errors that i'm getting
Cannot convert type 'WindowsFormsApplication26.Employee[]' to 'WindowsFormsApplication26.Manager' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
When downcasting the conversion returns to null.
Also Under manager class i have to mention the line
private string name ;
despite using the base keyword in the constructor above it. Otherwise the name parameter is not recognized by the class.
Link to comment
https://www.neowin.net/forum/topic/1322268-upcasting-and-downcasting-an-array/Share on other sites
3 answers to this question
Recommended Posts