0
Guys what is the main function of constructors ?
do we use them isntead the getters and setters
5 Answers
+ 5
constructors are mainly for initializing attributes when the object is instantiated.
Or, in layman's terms:
When you create an Object
Getters and Setters can be used later on after the object is already created.
So, constructors aren't replacing getters and setters, since they are used together.
(Constructors for when the object is made, setters for when the object is already made.)
+ 3
laymans terms means saying somthing else that is easier to understand. đ
0
what are laymans
- 1
Yea, basically we use them in place of the getters and setters, but they have a slight difference between them.