a great concept in OOP is Encapsulation which represented in a concept called Data hiding

Data hiding
The concept of data hiding is to hide data!
the reason beyond hiding data is to protect it from user while accessing it

suppose we have the following code

class Person
	char* name;	// C++
	String name;	// Java
	string name;	// C#
	int age;

the two ways to access the data :

  • Setting the value
  • Getting the value