Python
# Program to demonstrate private variables (name mangling)
class Secret:
def __init__(self, data):
self.__data = data
def reveal(self):
print("Secret is:", self.__data)
s = Secret("hidden")
s.reveal()
# Direct access would fail: s.__dataOutput
Secret is: hidden
Attributes starting with __ are name-mangled to _ClassName__attr, discouraging external access.