I know, this is not the right thing to do in regards to challenging student behaviors; But this is often what is said when "setting an example" is done totally wrong or inappropriately. If you are really really good (and experienced), it can be done both artfully and appropriately and oftentimes, similar difficult behaviors will not be experienced again. However, it is a risk 99% of people should probably not take if they want to avoid doing it wrong. For example, a student wise cracks at something you say. Clearly, this shows disrespect towards you and it undermines you in front of the class. It might be a test- especially for new instructors. What would you do?