I am just wondering how memory handling is done for a string object in c++.
I have below code:
#include <iostream>
using namespace std;
int main() {
    // your code goes here
    string str = new char[30];
    str = new char[60];
    
    delete[] str;
    return 0;
}
This piece of code will definitely throw an error, but can someone explain me in detail why this is an error ? And will the above declaration assign a total of 90 bytes to str ?
Thanks in advance
 
    