Hello, I am curious if it is possible to create a string without using the 'new' keyword and access this string with pointers of other objects. Is it possible to keep a string even though the object that created it is deleted? Where are std::strings stored in memory?
An example of what I want to do(using the 'new' keyword) is the following.
Well I wanted to access the string even after the StringKeeper object destruction. I know I can do it if I dynamically allocate it with 'new' keyword and then skip 'delete' in the destructor, but I was curious if there is any other way.
Hmm ok, thank you.
But my main question was if there is any way to create an std::string inside the class but store it outside of the class (but not in the heap). So even if the object that created the string gets destructed another object that will have the address of the string will be able to access the string.