Anthony Joshua retained his WBA 'super' and IBF heavyweight titles after stopping Carlos Takam in the 10th round.