Answers for "upcasting and downcasting in c#"

C#
0

upcasting and downcasting in c#

class Employee
{
    // some code
}
class Manager : Employee
{
    //some code
}
// casting can be done by the following
if (employee is Manager)
{
    Manager m = (Manager)employee;
}
// or with the as operator like this:
Manager m = (employee as Manager);
Posted by: Guest on July-28-2021

Code answers related to "upcasting and downcasting in c#"

C# Answers by Framework

Browse Popular Code Answers by Language