Actually, in Team Fortress 2 you're free to play as any of the nine classes and switch between them whenever you like. There's no restriction locking you into one.
On top of that, you can upgrade or swap out all your weapons, hats, misc items, and other gear for each class, giving you plenty of room to customize your loadout.