structObj is a pointer. structObj->x1 accesses the x1 value of the object that structObj is pointing to. If structObj is not pointing to a valid object this piece of code will obviously not work correctly.
If you don't want to use dynamic allocation you can simply declare structObj as a regular variable instead of a pointer.
delete structObj;
with std::unique_ptr<> or std::shared_ptr<> such statements are no longer required. Also ctor overloading and make_unique<> (or make_shared<>) can initialize the owned object in one go: