Your parents were wrong. Sugar doesn't cause cavities.
It's the BACTERIA eating the sugar that actually causes the damage.
Sticky food, like starches, attracts bacteria to thrive on and around your teeth. The bacteria then produce an acid compound that promotes tooth decay.
This is why we always suggest rinsing and brushing after meals to our patients. We know that's often not feasible in a busy life, so be sure to brush at night so those bacteria don't have a party in your mouth while you're sleeping!