Bill Gates: Here's how to figure out what you'll be world-class at

Bill Gates
Adam Galica | CNBC

Bill Gates dropped out of Harvard after two years to launch Microsoft, which he helped turn into a multibillion-dollar tech company.

He became a millionaire at the ripe age of 26, thanks to Microsoft's IPO, and today he's one of the world's richest people, with an estimated net worth of $90 billion.

During a Q&A with Harvard students last week, the entrepreneur shared a key to success: "The thing that you're likely to be world-class at is whatever you obsessed over from age 12 to 18. In my case, it was writing software."

Bill Gates: These skills will be most in-demand in the job market of the future

Gates has been fixated on tech since age 13, when he was a student at Lakeside School in Seattle, Washington. As Gates recalled in a 2005 speech, the school's "mothers club came up with the money to buy a teletype that connected over the phone lines with a GE time-sharing computer," and that machine effectively changed his life. He spent as much time as he could learning about computers, hacking and coding.

There's something to be said for chasing a dream. Some of the most successful people are fueled by their enthusiasm for what they're doing, including Gates' longtime friend Warren Buffett. "Being successful at almost anything means having a passion for it," says the Oracle of Omaha. "If you see somebody with even reasonable intelligence and a terrific passion for what they do, ... things are gonna happen."

Buffett's right-hand man Charlie Munger has a similar perspective. "I have never succeeded very much in anything in which I was not very interested," he says. "If you can't somehow find yourself very interested in something, I don't think you'll succeed very much, even if you're fairly smart."

Not every successful person says to find a career path that piques your natural interest. Self-made billionaire and "Shark Tank" star Mark Cuban, for example, says that following your passion is "one of the great lies of life."

But for Gates, Buffett and others, that career advice has worked wonders.

Like this story? Like CNBC Make It on Facebook!

Don't miss: If Bill Gates were in college today, here's what he would study

Bill and Melinda Gates say it's unfair that they have so much wealth