The above c++ code is pouring out error message.
I don't know meaning of the error message.
If I change the following code line, it silence the error message:
perhaps you can explain what it does wrong?
I see one issue. you do not initialize your ptr to nullptr, so any and all deletes could fail. it is fine to delete nullptr, nothing happens, but if you try to delete random value ptr from uninitialized value, it will not work.
unless this is a study in pointers, I advise you find a better way. Raw pointer manipulation is best avoided.
In constructor 'Demo::Demo(const string&)':
13:20: error: 'const string' has no member named 'content'
In member function 'Demo Demo::operator+(const Demo&)':
32:36: error: use of deleted function 'constexpr Demo::Demo(const Demo&)'
6:7: note: 'constexpr Demo::Demo(const Demo&)' is implicitly declared as deleted because 'Demo' declares a move constructor or move assignment operator
In function 'int main()':
39:26: error: use of deleted function 'constexpr Demo::Demo(const Demo&)'
Please indent your code. Even simple code becomes unreadable when you don't have proper indentation.
std::string contains no function called "content()". Your demo class itself is what contains the function called content.
You can simply called the copy constructor ptr = new string(str);
'constexpr Demo::Demo(const Demo&)' is implicitly declared as deleted because 'Demo' declares a move constructor or move assignment operator
This is your other error. If you want the Demo's copy constructor to work, you need to define it yourself.