C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

When compiler adds a default constructor to a class?


Posted Date: 28 Sep 2008      Posted By: partha chowdhury      Member Level: Silver     Points: 1   Responses: 1



When compiler adds a default constructor to a class?




Responses

Author: Selva    28 Sep 2008Member Level: SilverRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

Hi,
When no Constructor is provided in your class the Compiler will adds the default constructor.

If any parameterized constructor is present then the compiler wont add the default constructor.

Example
class A {

} // Here compiler adds default constructor

class A {
public A(int a) {}
} // Dont compiler adds default constructor



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : When static constructor is invoked?
Previous : what is the difference between passing a value object by reference and a reference object
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use