I hope you understand my example.
Not really. You can't store a String in EEPROM. You can only store the string that it wraps.
The String class uses malloc() to allocate the memory occupied by the string. If you must store strings in EEPROM (and your example does NOT illustrate that), then you too can use malloc() to allocate memory to write the string to. Just be sure to free() the memory when you are done with it.