+ 4
Getter-setter or Constructors ??
we can use getter-setter or constructors to access private data of class..which one is better ??
6 odpowiedzi
+ 3
hey
+ 2
Constructor to enter some stuff during object creation.
Getter to get private data.
Setter to change or set data to new value.
+ 1
😁 @Shruti Singh you will need all of them in different situations.
0
The reason for getter and setting is to acess private class and transfer data from one class to another
0
Shirut what language