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?
Answers were Sorted based on User's Feedback
Answer / gopal
Here ObjA is Base Class and ObjB is Derived Class.
In Inheritence Process Derived class Will get the all
features of Base Class.
because objB=O=objA Is COrrect
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
Explain about .net garbage collector?
Can you Explain <mobile:link> element .net mobile with example? : Microsoft dot net mobile
What is static Constructor?
two common properties for any validation control ?
What are .net mobile controls features? : Microsoft dot net mobile
Which tool you will use to deploy a windows service
Explain dma? : .NET Architecture
Why only boxed types can be unboxed?
Explain the difference between state server and sqlserver : Dot net architecture
What are the options provived by vss to the user? how it will help us while delevoping application?
What's new in the .net 2.0 class library?
What is a sealed Class? What is the differnce between sealed class and private class?