請看看下面的代碼
UIHandler.h
#pragma once
class UIHandler
{
public:
UIHandler();
~UIHandler(void);
private:
//Book *books;
};
UIHandler.cpp
#include "UIHandler.h"
#include <iostream>
using namespace std;
UIHandler::UIHandler()
{
{
//action once code goes here
}
int selection;
cout << "..............Welcome to DigitalLab Library..........." << endl << endl;;
cout << "Kindly press, " << endl;
cout << "1. Enter Books" << endl;
cout << "2. Display Books"<< endl;
cout << "3. Member Area" << endl;
cout << "Your Selection: ";
cin >> selection;
}
UIHandler::~UIHandler(void)
{
}
Main.cpp的
#include <iostream>
#include "UIHandler.h"
using namespace std;
int main()
{
UIHandler a();
system("pause");
return 0;
}
在這段代碼中,我無法執行的UIHandler構造函數中,因爲代碼運行,但沒有任何反應。如果我將一個參數傳遞給UIHandler構造函數,它就像它應該那樣工作,即使我不使用構造函數。這是爲什麼?請幫忙!
感謝您的回覆,但重複?我在哪裏打開這樣的另一個問題?通常當產生重複的副本時,就會產生重複的線程。它在哪裏? –
一個dup意味着這個問題已經問我的其他人。 :)你可以從前面的問題找到答案 – billz
哦!好吧,我現在無論如何都有答案,沒有看那些;) –