I like the analogy of it just being a custom type (that's basically how it's used in templates). Another important aspect is
functionality. A class isn't just a kind of thing, a class also
does stuff.
You mentioned sound effects. Perhaps, in a game, you want a sound effect to be played upon getting an item. Item and SoundEffect could both be classes. But what does a SoundEffect do? A sound effect
can play a sound. Pretty simple, just from a functionality point of view.
Your code, might be as simple as this:
1 2
|
SoundEffect sfx("my_sound_effect.wav");
sfx.play();
|
A class defines a
thing that has
functionality self-contained in it.
Furthermore, what's good about this class is that, if designed correctly, I don't (generally) need to know
how that class is implemented under the hood. What I do know about is its public interface (I can make a sound effect by loading a music file, and I can play that sound). [In reality, there might be more customization you want, but these are all features which can be added.]