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



2. I've a class Parent Class A and a Derived Class B. Here is a scenario. I've an instan..

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

2. I've a class Parent Class A and a Derived Class B. Here is a scenario. I've an instan..

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

Post New Answer

More Dot Net AllOther Interview Questions

what is the method while we are using adapter and dataset ?

0 Answers  


Explain write back and write through caches? : .NET Architecture

0 Answers  


wild card character in sql ?

2 Answers  


What is the application frame host?

0 Answers  


What is the difference between metadata and menifest ?

0 Answers  






What are the major differences between services and web services?

0 Answers  


What is the difference between custom controls and master page?

1 Answers   Tesco,


Explain the race around condition? How can it be overcome? : Dot net architecture

0 Answers  


Explain cache? : .NET Architecture

0 Answers  


12. Types of polymorphisem[Run and Design Exp.]

0 Answers   PCS,


Please tell me the .net 2.5 frame work with example

2 Answers  


how to add list of items in a web application and win application?

0 Answers   Six Sigma,


Categories