ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  Dot Net  >>  Dot Net AllOther
 
 


 

 
 Dot Net Framework interview questions  Dot Net Framework Interview Questions
 Dot Net Remoting interview questions  Dot Net Remoting Interview Questions
 Dot Net WindowsForms interview questions  Dot Net WindowsForms Interview Questions
 Dot Net General interview questions  Dot Net General Interview Questions
 Dot Net AllOther interview questions  Dot Net AllOther Interview Questions
Question
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?



 Question Submitted By :: Srikanth
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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
Ashok
 

 
 
 
Other Dot Net AllOther Interview Questions
 
  Question Asked @ Answers
 
what is authentication and authorization?how do they differ? Six-Sigma2
Please tell me the .net 2.5 frame work with example  2
How many types of assemblies are there in the visual studio.net? Six-Sigma1
IN C# if we click a field in the dropdownlist then i have to get the respected field details in the next textbox..........  2
how do u achieve multilevel inheritance in .NET ? Ness-Technologies6
What is the difference between a web custom control,web user control and a web part. 247Customer1
how to find the 2nd higgest salary in the column for example take table name is employee? And also find bottom 2nd lowest salary ? GeoTechnology6
What is the difference between abstract class and Interface? Give an example how will u write an abstract class using .NET Framework T3-Softwares4
Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component  1
Explain in-proc,out-proc and sql server. Ness-Technologies3
Which is the best institute in chennai to learn DotNet? Please help.  15
how windows applications different from the console applications? Six-Sigma1
What is this DLL hell problem in dotnet? Can a virtual class be created/can a virtual method be created inside the class? HCL2
What is the main Difference Between .Net 2003 and .Net 2005.and also Asp1.1,Asp2.0 and Asp3.0 Satyam4
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. 247Customer1
What is VSS? Use of VSS? How can we use VSS in our Application?  2
what is ado.net HCL6
Let's say I have an existing application written using Visual Studio 6 (VB 6, InterDev 6) and this application utilizes Windows 2000 COM+ transaction services. How would you approach migrating this application to .NET ?  1
does .NET support multiple inheritance ? Ness-Technologies10
How to send e-mail to gmail/yahoo or any other ID from your mail server.I need the code.  1
 
For more Dot Net AllOther Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com