You are confusing class D amplifiers with switchmode power supplies, or SMPS.
SOME SMPS, not all, are "universal" types and can indeed run on 120 or 240 simply by connecting to the mains. MAny or dual voltage 120/240 but to change requires a switch or a jumper wire be moved. Some are designed to run on just one or the other mains voltage.
That is just the power supply.
Class D refers to the power amplifier. That requires specific operating voltages and that has no relation to mains voltage. It requires that whatever power supply is used produce those specific voltages.
Mains frequency - Hertz - also has nothing to do with the class D power amp. It also doesn't generally affect SMPS.
Also, not every class D amp has an SMPS, some have plain old linear supplies - the large power transformer and filter caps type. Most all of those I have ever seen didn't really care about 50/60Hz, but they do care about mains voltage.