I am bit confused when it comes to classes.I can create a public function so I can call it from anywhere inside my program. Why would I create a private function?
Could you please give me an example?
A private function would be used inside my class.
What kind of complex calculation would you do inside a class that you need to create private functions ?
I know that my question might sound stupid but please if you have time to give me some examples I would really apreciate.
An example where I've used private functions is when I was writing an equation compiler and I didn't want the whole process to be a single 1000 line function so I split it into lots of private functions such as preprocessing function (insert implied operators, validation), lexing functions, parsing functions and utility function that would have no use outside of the class (such as finding the next pair of brackets to parse between).