myClass obj= *(new myClass());
This first creates a myClass object with automatic storage duration named obj. This object is initialised by the expression *(new myClass()). This expression dynamically allocates a myClass object and then dereferences the pointer to that object. So what you end up doing here, is dynamically allocating an object and then copying that into obj.
You've now lost track of the dynamically allocated object. That's not good. Doing delete &obj; will only take the address of the automatic object and attempt to destroy that, but you must only use delete with dynamically allocated objects.
You could change obj to be a reference and it would work:
myClass& obj = *(new myClass());
This makes sure the dynamically allocated object isn't copied. However, this isn't a good idea. It masks the fact that obj refers to an object that must be deleted. Instead, you're better off storing the pointer itself:
myClass* obj = new myClass();
// ...
delete obj;
Or even better, use a smart pointer like std::unique_ptr<myClass>.
Or even betterer, don't even both dynamically allocating it. Just use an automatic object:
myClass obj;
// No need to allocate or delete anything
newanddeletethat.myClass obj;and just losing thedeleteentirely?newhere. Automatic storage is ideal.myclass obj;no delete needed.