C++
Encapsulation (getters and setters) in C++
seoca
2018. 11. 6. 12:34
Encapsulation (getters and setters) in C++
In C++, encapsulation is a very popular feature to hide data.
All data members have to be private so outside entities are not able to access the data directly. It protects the data from modifying. If change is needed, getter and setter function should be set to access the private data from outside.
Example code