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 |
what is the method while we are using adapter and dataset ?
Explain write back and write through caches? : .NET Architecture
wild card character in sql ?
What is the application frame host?
What is the difference between metadata and menifest ?
What are the major differences between services and web services?
What is the difference between custom controls and master page?
Explain the race around condition? How can it be overcome? : Dot net architecture
Explain cache? : .NET Architecture
12. Types of polymorphisem[Run and Design Exp.]
Please tell me the .net 2.5 frame work with example
how to add list of items in a web application and win application?