it means that
By doing something good, you inspire others to do good aswell.
Instead of lecturing his children about kindness, their father spent Saturdays helping elderly neighbors. Soon the children volunteered to join him; a good example is the best sermon.