Saturday 23 April 2016

C# Constructor Vs C# Method.


Constructor
Method
It is used to initialize an object.
It is used to exposed the behavior of
Constructor can’t have return type.
Method must have return type.
Constructor is invoked implicitly.
Method is invoked explicitly.
The c# compiler provides a default constructor if you don’t have any constructor.
Method is not provided by compiler.
Constructor must be same as class name.
May or may not be same as class name.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.