Understanding Section 2 Lecture 46 IsIsogram() as private?


More of a general question…

I am relatively new to programming and I have been working through lectures to create the first C++ game - The Bulls and Cows.

The lecture did not explain why the method IsIsogram() is placed in the private part of the header file… What difference would it make to put it in a public part?

If it is however crucial to have it a private method, then why? I would love to have a good insight on this.

Thank you.

You normally put every function that has NOT to be accessed from outside of the class into the private section.

It’s part of encapsulation and has no effect on how the code inside the class works. It just makes sure that noone misuses your functions and keeps the interface clean.
Just imagine the pain when over 200 methods and parameters pop up when you type something like this:


and you have to scroll through them to find the one you are looking for.

1 Like

Privacy & Terms