Thread threadの場合は、コンストラクタとデコンストラクタの
表示がありますが、
Thread *pthreadでは、デコンストラクタの表示がありません。
下記のコード参照
Q1)このデコンストラクタの表示がない件について、説明頂けないでしょうか?
//mainwindow.h================
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "thread.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
Thread thread;
Thread *pthread;
};
#endif // MAINWINDOW_H
//mainwindow.cpp================
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow){
ui->setupUi(this);
pthread=new Thread;
}
MainWindow::~MainWindow(){
delete ui;
}
//thread.h=============
#ifndef THREAD_H
#define THREAD_H
class Thread{
public:
Thread();
~Thread();
};
#endif // THREAD_H
//thread.cpp=============
#include "thread.h"
#include <QDebug>
Thread::Thread(){
qDebug("Constructor");
}
Thread::~Thread(){
qDebug("Deonstructor");
}
以上、宜しくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。