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
what is the difference between convert.tostring() and tostring() functions ?
What is a class in unity?
What is garbage collection? How to force garbage collector to run?
Does c# support c type macros?
Explain clr in brief.
Explain about Error handling and how this is done
What is the use of static members with example using c#.net.
What is a sealed class?
What is option parameter in C#?
What are controls in c#?
What is an icollection in c#?
What are methods in C#?
Why main method is static in c#?
Why singleton class is sealed?
What is poco c#?