Constructors in C# dot net and types of Constructors with examples programs
Constructors in C# dot net and types of Constructors with examples programs :-
Constructors in C# dot net :
<Access modifier> <Class name()>
{
Initialization Code
}
types of Constructors in C# dot net
Constructors in C# dot net :
- A constructor is a member of class.
- A constructor is a special type of a function.
- It will invoke automatically when an object is created.
- In general we can write any type of code in constructor and their is no rule to write only particular type of code.
- With in constructor we will write initialization code.
- constructor will not return any value due to that reason which will not have return value.
- A constructor name should be always same as the class name.
- In general constructor is used to keep something ready for the object when an object to the class is created.
Syntax to define a constructor:
<Access modifier> <Class name()>
{
Initialization Code
}
types of Constructors in C# dot net
0 comments:
Post a Comment