Prime Minister David Cameron, who promised to resign after Britain voted to leave the European Union, had some advice for his opposite number.