There is a phrase that has become popular in teaching:
Praise in public. Punish (or criticize) in private.
I think this depends upon a lot of factors, and especially the climate and culture of the classroom. If a teacher is adept at bringing the class together as one big family, or a particular class has come together on their own, then much more can be said in the open.
If there is trust and love in a classroom, then most things can be said out in the open.
It’s also important to remember that private rarely remains private. The notion if private is oftentimes a farce.
One of the biggest mistakes that teachers make is not allowing a student who they are reprimanding to maintain his or her dignity. Criticizing in public is often perfectly fine if the student does not feel isolation or shame in the process. Creativity, flexibility, and a willingness to subjugate one’s ego are often required in order to reprimand a student without losing that student’s trust and respect.
Consequences are important. Self esteem is, too.