Private display()

Why made another function for display and that too private ? Why cant the code be put into public function ?

Hi @Vikas-G-141583313319037,
See a private function cannot be accessed outside the class body hence making the code private will make it safe from any changes made from outside the body .Hence once we write the code of a display function in a private function we can call the private function using the public function .This is a functionality of OOPS(object oriented programming) to keep data safe.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.