There are a class A. Another class B derived from it.
Now if I do A a = new B(); and B b = new B(); What will
happen in both the statements. And what is the difference
between these two statements.

Answer Posted / ashok kumar

A is a base class, B is a derived class.
Which means we cad access all the data of A class in B class.

Public A
{...}
Public B:A
{...}
Class VoidMain()
{
A a=new B();// Creating object for A class(can access the A
class data only).
B b=new B();// Creating object for B class(can access the
A,B class data).
}

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is yield return in c#?

486


How many digits is a 32 bit number?

464


What are the types of inheritance in c#?

489


What is the difference between icomparer and icomparable in c#?

454


What is mean by c#?

469






List some Advantages of switch-case over if else?

485


What is writeline?

469


Explain how to implement an object pool in c#.net

512


Hi Friends, I am going through Siemens Interview Procedure from last 1+1/2 months. I went through 1 written + 2 Technical + 1 Managerial Round process after which I got call from HR informing that "you are selected and we would like to meet you for HR round". HR round was very nominal compared to MR. HR Round last for hardly 5 mins. They told me that you will get the final result on Friday. Still I have not received any feedback from them. Please help!!!

16602


What is array class in c#?

449


What is xamarin used for?

498


What is the root element of an xml file?

487


What is a deadlock lock?

482


Does c# provide copy constructor?

567


What is a delegate? How can it works?

515