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 / srushtitha.

here,A is Base class, B is Derived class.
in the first statement "the object of B is stored in parent
clss reference"(Runtime Polymorphism).

-->In the secend statement "the object is creacted for the
child class.

Is This Answer Correct ?    23 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are data types with examples?

485


What are the principles of delegation?

469


What is parsing?

503


In languages without exception-handling facilities, we could send an error-handling procedure as a parameter to each procedure that can detect errors that must be handled. What disadvantages are there to this method?

575


What is func delegate in c#?

484






Is .net and c# the same?

528


In a single .NET DLL how many classes it contains?

489


What are the different types of classes?

457


What is a hash table in c#?

480


What is xml c#?

464


What is a byte in c#?

531


What is eager and lazy loading in c#?

453


Why can't we use a static class instead of singleton?

433


Should I use double or float?

476


What is c# console application?

458