Type of constructor in c sharp

Constructors are of two types

  1. Parameterless constructor
  2. 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