What is type casting. Explain it with reference to classes.
Answer Posted / kiran vaidya
Type casting means converting some type to some another
type.
for example, there are three classes:
class Employee
{
//Logic for this class
}
class Manager:Employee
{
//Logic for this class
}
class Clerk:Employee
{
//Logic for this class
}
class Program
{
static void Main(string [] args)
{
Employee e=new Employee();
//Type casting
Manager m=(Manager)e;
//Or
Clerk c=(Clerk)e;
}
}
| Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
We cannot create instances of static classes. Can we have constructors for static classes?
What is anonymous types in c#?
What is a boolean c#?
What is an Interface in C#?
What are the different types of constructors?
What is .net console?
Define delegate in c#?
Which program construct must return a value?
What is the interface in c#?
What are modifiers in c#?
What is the use of delegates in c#?
Enlist some of the properties of a thread class?
Is vs as c#?
What is the Signification of the "new " keyword in C#? example
What are winforms in c#?