2. I've a class Parent Class A and a Derived Class B. Here
is a scenario.
I've an instance of Class A as objA and an instance of Class
B as objB.
I can refer a child class variable as objB=objA, but
cannot do objA=objB what is the reason?
Answer Posted / ashok
Is this you are trying to do?
class A
{
public int MyName { get; set; }
}
class B : A
{
public int MyName1 { get; set; }
}
public class TestAB
{
public static void Test()
{
A objA = new A();
B objB = new B();
objB = (B)objA; // Unable to cast object of type
'AdvanceLib.A' to type 'AdvanceLib.B'.
objA = objB;
}
}
---
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do you handle this COM components developed in other programming languages in .NET?
What is an interrupt? : .NET Architecture
Explain .net mobile input controls? : Microsoft dot net mobile
Is .net easier than java?
How to upload in video,mp4,in .net 4.5 ..?
What is the difference between an application and a program?
Describe the Managed Execution Process in .NET?
What happens when you try to update data in a dataset in .net while the record is already deleted in sql server as backend?
Can I create my own permission set?
What is ILDASM ?
I am working with asp.net 2005 and Crystal report 10. I have an image field on my dataset to show on Crystal report.And the image is shows dynamically from database in image field of CR. The image field is showing well on my Crystal report on its first page with all other data but when i click to open second page of CR,it does not show any data on that.I found that this is because of adding the image field on crystal report. Because when i remove the image field from the CR then it will run both the pages of CR. I am using the Page Load event to bind CR data with Database. And i have already check with the Init event to bind CR , but it still not shows the data on second page when i use image field on that. Please give solution for that.....
Can you explain update progress control?
What is the use of web.config?
Describe the advantages of writing a managed code application instead of unmanaged one. What is involved in certain piece of code being managed?
What is Com Callable wrapper?when it will created?