First things first: a freewheel is not a cassette. There are several differences between the two. In a cassette, the ratcheting mechanism is part of the hub and is integrated, not screwed on. A freewheel is threaded onto the hub. A way to tell is to look for a flat lockring on top of the smallest cog. If it has splines or grooves, it is a cassette and not a freewheel.
Cassettes are used more typically nowadays, whereas freewheels can be found on older bikes.
You also have to remember that most companies make their freehubs non-compatible with cassettes from other companies. So if you have a Shimano cassette and need to replace a cog, a Campagnolo will never work because they are splined differently.