Answering this question because I have seen some bad practices that other DMs have done.
Some DMs may tend to "give a clear figure of the class" somehow. That lets a character identify another character's class simply by looking at it. The good side is that the bar of character description can be lowered and may add more class-specified flavor to the characters; the bad side is that the characters who don't want their classes to be discovered can find the world being hostile to them. (The Rogue PC complained to me (while I am not on that table) that every NPC knows he is a rogue and would start being alert at the instant they see him.)
Normally, without the help of certain spells/feats, no one can identify another character's class simply by looking at them without applying some class-based stereotypes, or "dress codes".
- Wizard and Sorcerers tend to be wearing robsrobes with no armor.
- Paladins and Clerics tend to wear plate armors or other sorts of heavy armors.
- Rangers, Rogues, Bards and Barbarians tend to wear light armors like leather armors.
- Fighters could wear any kindskind of armorsarmor based on their needs.
- Monks mostly won't wear armors at all, but neither wear robes, and would normally be able to see their muscles.
- etc.
That would be the easiest way to identify a character's class, which is also the easiest way for a character to disguise their class.
A character could also roughly identify another character's physical attributes by looking at their body. Someone with high STR tend to be looked strong, high DEX could indicate the character is swift and balanced, high CON could make someone seem energetic, etc. While the mental attribute is likely not shown outside, high CHA can make a character look friendly and approachable before even talking to them (which means the Diplomacy skill hasn't come into play yet). So, if a Fighter is pretending to be a Wizard, other people may doubt that this Wizard is "too strong" to be a Wizard.
There're also some other special rules for class identification. For example, Clerics and Paladins tend to have strong (stronger than most ordinary characters) alignment-based aura that shows their connection with their deities. There's also a feat called Vatic Gaze (PHB II) which can let you know the highest spell an opponent can cast by simply looking at them and passing a Sense Motive check (but without telling you what kind of spell (arcane or divine) the opponent can cast).
PS. @KRyan has provided the Lore-relevant settings. But those are seems to be the way that a character can get the background knowledge around a class, rather than the way for a character to know what class their opponent takes.