What happens to the myClass
pointer when the foo
function finishes? Is it automatically deleted?
What happens to myThread
pointer when the bar
function finishes? (Supposing that myThread
points to a QThread
object)
void foo()
{
MyClass *myClass = new MyClass();
myClass->doSomething();
}
void bar()
{
// Suppose that MyThread is a QThread class
MyThread* myThread = new MyThread(2.5);
// Connect the Thread to get the result
connect(myThread, SIGNAL(sendResult(double)), this, SLOT(getResult(double)));
// Start the thread
myThread->start();
}
Thanks in advance