Private concept doesn't understand

why you have taken display function as private, what is the significance of it here. what if I take it as public.

Doesn’t matter, you can take it private or public, but it is usually preferred to take functions which are called by only other instance methods to be private from the data hiding point of view.