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

how to manage session in webgarden ?

3 Answers   Binary Logics, Ness Technologies,


How Web service create Proxy Using WSDL?

1 Answers  


3. Should validation (did the user enter a real date) occur server-side or client-side? Why?

4 Answers  


State and explain about microsoft.net?

1 Answers  


Whate are resource files? How are they used in .net?

1 Answers  


What is a virtual memory? : .NET Architecture

1 Answers  


What is the purpose of Accordian in jquery? Where it can be used?

1 Answers  


1. How to restrict a class from allowing to create only one object. I.e., one should be allowed to create only one object of the class type.

1 Answers   247Customer, FinEngine, TCS,


10. Overloding and overriding.

2 Answers   PCS,


What is Ienumerable

1 Answers  


How to develop mobile applications using microsoft mobile internet toolkit (mmit) or .net mobile? : Microsoft dot net mobile

1 Answers  


What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

2 Answers   Siebel Systems,


Categories