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
If I have more than one version of one assemblies, then how'll I use old version (how/where to specify version number?)in my application?
To create a localized application which namespaces are necessary?
Can abstract class have constructor c#?
What is the difference between system.text.stringbuilder and system.string?
While debugging a C# application can you change the value of a variable?
How big is int16?
Assembly Code. in Rejester AL. How do Contast Replece( or Change): Bit D3 With Bit D4 and Bit D2 With Bit D5 and Bit D1 With Bit D6 and Bit D0 With Bit D7 I am Not Know Very Well Write English.
Explain async and await?
What are the different types of delegates?
When was c# created?
What is tryparse?
What are the properties of string?
What is generic in c#?
What is an iqueryable in c#?
Are c# generics the same as c++ templates?