I want to seek help on this issue I encountered when learning C++. I tried to store objects into an array directly, but realize the objects gets deconstructed right away. I could not figure out why exactly is this so.
#include <iostream>
class Thing{
public:
~Thing(){
std::cout<<"Thing destructing";
}
};
int main(){
Thing arr[1];
arr[0] = Thing();
int x;
std::cin>>x;
};