Dungeons & Dragons popularized classes. They are now found in many popular games. Dungeons & Dragons also provided a set of four classes that many players consider prototypical among games with classes: fighter, thief, magic user, and cleric.
Classes provide direction and limitations for characters. For example, a thief will usually be provided abilities such as lock picking, but probably would not be able to wield magic as well as a mage. Game designers use the limitations provided by classes to encourage (or enforce) interdependence among characters. The most obvious example would be the mutually beneficial combination of a fighter and a cleric (who can heal wounds). Some RPGs restrict the classes a character can choose based on alignment, race, or stats (this is rare now).
A common alternative to class-based systems, skill-based systems are designed to give the player a stronger sense of control over how their character develops. In such systems, players choose the direction of their characters as they play, usually by assigning points to certain skills (such as "fighting with a one-handed weapon"). Advancements in class-based systems have sought to provide players similar control by presenting options as the player progresses in level. These options include prestige classes (a form of sub-class), multi-classing (advancing a character in two or more classes), and hybrid skill systems.
See also: List of character classes, a list of character classes from various RPGs