If I were looking after a child, and they were in my responsibility (and what on earth have I done to deserve that?), I would do as the parents wish, unless it's something ridiculous, like "make sure to molest him whilst we're away!" (obviously I am being facetious here).
If, however, I am on the street and people ask me to change my behaviour they can go screw. For instance, a while back, there was a mother and child stood at some traffic lights, waiting for the green man so they could cross the road. I swore, saying "for fuck's sake", and the woman decided to have a go for swearing in front of her child. I calmly told her it's not my job to raise her kid, and if he starts swearing because he heard me say it then she clearly isn't doing her job very well. After that she moved down the road a bit and crossed, so clearly she was setting great examples herself.
Edit: It wasn't even just that she told me off, it was the way she did it. If she'd politely asked me to not say it, I'd have probably said okay, not that I would have sworn in the next 20 seconds before we went our separate ways anyway.