About Constructor initialization

Posted by Saravanan05 under C# on 5/19/2014 | Points: 10 | Views : 325 | Status : [Member] | Replies : 1
Hi

This is the interview question:

If we compile the class, it will create Constructor automatically.(if we are initialize the Constructor).

why compiler create Constructor automatically?

what is the use of it?




Responses

Posted by: Sheonarayan on: 5/19/2014 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hi Saravan...

Thanks for asking question.

Yes, the constructor gets created automatically if you have not defined explicitly however there is no use of this constructor as you will not be able to use it.

To answer your remaining question, I would encourage you to read following posts of DotNetFunda.com as this will give you answer to most of the questions you might have about constructor .

http://www.dotnetfunda.com/interviews/show/4054/what-is-constructor-chaining
http://www.dotnetfunda.com/articles/show/1960/types-of-constructor-in-net
http://www.dotnetfunda.com/interviews/show/356/constructor-and-destructor

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Saravanan05, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response