What can you learn from someone who treats you like an idiot, ignores your ideas, and belittles you in public? A lot, as it turns out.

A few months ago, I attended a talk from a respected founder and CEO who gave much of the credit for her own leadership philosophy to the worst boss she had ever had. She said she simply thinks of the things he did and does the opposite.

Upon hearing this story, I realized that I had had a very similar experience. I think it's actually a pretty common story among entrepreneurs. Many of us start our own companies in part because we don't want to work for anyone else. The bad experiences are a constant reminder of what we don't want to do or be. You could call it "opposite modeling."

Talk to enough founders or CEOs, and you'll notice that many of them struck out on their own after working for an oppressive boss and never forgot that lesson. Here are a few examples.

1. If you want loyalty from others, be loyal to them.

We've all worked for hot-and-cold leaders. But one of Erik Huberman's bosses took it to a new level. Now CEO and founder of Hawke Media, Huberman recalls that his supervisor's critical emails seemed to be forgotten the moment he walked into the guy's office.

"I would receive crazy, long-winded emails about all of the terrible work I was doing, and then I would confront him, and he would say, 'Don't worry, it isn't a big deal.' It felt like I was getting a lot of fake smiles in person but getting screamed at through email. It killed any loyalty the team felt toward him, and turnover skyrocketed," Huberman says. "Eventually, he was kicked out of his own company."

Huberman's takeaway: "I learned to respect the people around me. If I'm going to ask team members to have my back, then I have to prove that I have theirs, too."

2. Trying to cover up problems only makes them worse.

People problems are inherently complex. But challenges don't go away when they're swept under the rug; they multiply. Business consultant Don Maruska learned that lesson when working with a CEO who struggled to engage employees.

Looking to reassure his team, the CEO set up small-group sessions. Rather than ask about employees' frustrations, however, he just told them that the business was great and that they had the chance to contribute to its success.

"While he thought he did a wonderful job, he heard reports back that many employees felt even less engaged," Maruska told Monster. By doing all the talking and none of the listening, the CEO effectively communicated that his employees' concerns weren't important.

3. Admitting you're human establishes trust.

What's the most important lesson Leo Wang, founder and CEO of Buffy, got from his terrible boss? To not be afraid to show your emotions. 

Wang learned the value of emotional vulnerability while working for a partner at McKinsey who, according to Wang, was a good person but lacked the skills to become a strong manager because he couldn't show his true self.  

Although emotional outbursts don't belong in the workplace, stoicism erects barriers. Expressing emotions appropriately generates trust and gives others the green light to show their own feelings.

4. Discouraging new ideas and feedback stifles innovation.

In my last full-time job, employees had to handle retail sales and customer service calls simultaneously. Since this wasn't working well, I suggested that we assign one person to handle calls and free the front desk staff to work with the clients. The CEO responded by saying, "There is just nothing you can't find a way to spend money on." Not only was this dismissive and demotivating, it ignored the obvious problem. It was also the moment I decided to quit.

When I started my own company, Acceleration Partners, I made it a policy to listen to employee feedback. I've gained a lot of great insights from my team, so I am grateful for this early bad experience.

While no one enjoys having a bad boss, wise leaders can find ways to learn from all their experiences--even the most unpleasant. So, in addition to seeking out positive mentors and role models, consider looking back at the leadership failures you've seen in your career. Discovering what not to do in a position of power can be truly enlightening.