Implement a class named Person
with private attributes name
and age
. Write a method to display these attributes and make sure the attributes are accessible only within the class.
Example 1:
person = Person("Alice", 30)
print(person.display())
Output: "Name: Alice, Age: 30"
Example 2:
person = Person("Bob", 22)
print(person.display())
Output: "Name: Bob, Age: 22"