Constructor a special type of method witch will execute automatically fo the time of object execution .constructor are using to execute a block of statements at the time object initialization .
Constructors are -------Default constructor.
Parameterized constructor
Static constructor
Copy constructor
Default constructor---
A constructor with out parameters is called default constructor. Some time compiler create a default constructor if existing constructor not formed in the class.
Parameterized constructor—
The Parameterized constructor contains Parameters witch is useful to pass the values while creating object.
Copy constructor--- Copy constructor similar to parameterized constructor but here we will send individual values as a single object.
Static constructor---the Static constructor is a special type of constructor witch will execute only one time even if we create more then one object. static constructor can’t don’t supports parameters. In this we don’t use excess specifiers the static constructor. to create static constructor we need to use (static) keyword.
Comments
Post a Comment