06.Chapter-1 Constructor
06.Chapter-1 Constructor
Educator:
Asst. Prof. Ms. Twinkle S. Panchal
Sutex Bank College of Computer Applications and Science, Amroli
Constructor
¬ A Constructor is a ”Special Member Function” whose task is to initialize the
objects of its class.
¬ It is special because its name is the same as the class name.
¬ The constructor is invoked whenever an object of its associated class is created.
¬ It is called Constructor because it constructs the value of data members of the
class.
return 0;
} 305- Object Oriented Programming
Educator: Ms. Twinkle S. Panchal
2) Parameterized Constructor
¬ Default Constructor initialize the data members of the class with the default values.
¬ It is also possible in the constructor to initialize the data members of the class with
different values.
¬ C++ permits us to achieve this objective by passing arguments to the constructor
function when an object is created.
¬ Those constructors that can take arguments are called parameterized constructor.