There are two ways of restoring, in one option, you have to restore your iPhone from backup, and in the other option, you restore your iPhone through factory default settings. In the former option, while restoring an iPhone from either iTunes or iCloud backup, you wouldn't delete everything except your last file created after your backup. On the contrary, restoring your iPhone through factory settings, all data, including contacts, messages, photos, and other data of your phone, will be deleted. Your iPhone will turn into a new phone after factory restoration.