Constructors are of two types
- Parameterless constructor
- Parameterized constructor
- A constructor without any parameter is a parameterless constructor, This can be define either by the programmer explicitly or else will be defined Implicitly by the compiler provided the class doesn’t contain any constructor in it.
- A constructor if defined with any parameter is a parameterized constructor and these constructor can be define explicitly by the programmer only.
Note : If the constructor of a class is parameterized then values to those parameters must be sent while creating the Instance of the class.
No comments:
Post a Comment