It was narrated that Abu Hurairah said:
"The Messenger of Allah said: 'The rewards of the good deeds that will reach a believer after his death are: Knowledge which he taught and spread; a righteous son whom he leaves behind; a copy of the Qur'an that he leaves as a legacy; a mosque that he built; a house that he built for wayfarers; a canal that he dug; or charity that he gave during his lifetime when he was in good health. These deeds will reach him after his death.'"