A->B->C (EXTENDS)
How the constructors are called when we created an object of C

Answer Posted / ramkishore mateti

When you intantiate Class C then the Class C Constructor
calls its base class(class b) constructor, Class b calls
its baseclass constructor i.e Class a, Class a calls its
base class constructor System.object.System.object
intiallizes class fields, then it comes to Class a it
intializes thier class fields and it comes to Class b after
intilalizion at last the Class C constructor intializes
their class fields.
Hence the Hierarchy of class Constructors are called are
a , b, c

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a thread? What is multithreading?

717


What is a collection in c#?

684


Explain how do I get deterministic finalization in c#?

684


Why do we need constructor?

672


What are the 2 broad classifications of fields in c#?

720


What does an indexer do?

636


Are c and c# the same thing?

661


How to do and Apply Themes to Datagrid,Lable,Textbox,etc., in C#.NET 2005 Windows Application? (like who we will do themes in ASP.NET using .CSS and .SKIN files). Urgent!!

1869


Is class reference type c#?

715


What is wrong with the sample program below?

683


If casting fails what type of exception is thrown?

652


What is the difference between the debug class and trace class? Documentation looks the same.

729


What is the difference between first and firstordefault?

665


What is the difference between system.text.stringbuilder and system.string?

740


Can we override interface methods in c#?

651