所以,我不斷收到一個錯誤,說我需要一個不合格的id,並且不知道是什麼給了我錯誤。 請幫忙。錯誤:在'''''令牌'之前預期的不合格id節點()
錯誤發生在類的Node()
部分。
error: expected unqualified-id before ‘)’ token
Node()
^
下面的代碼:
#include <iostream>
#include <string>
using namespace std;
class AHuffman
{
public:
class Node
{
Node* right_child;
Node* left_child;
Node* parent;
Node* sibling;
int weight;
int number;
string data;
};
Node()
{
right_child = NULL;
left_child = NULL;
parent = NULL;
sibling = NULL;
weight = 0
number = 1;
data = "";
}
// int encode(string* msg, char** result, int rbuff_size);
// int decode(string* msg, char** result, int rbuff_size);
AHuffman(string* alphabet);
~AHuffman();
};
int main(int argc, const char* argv[])
{
if(argc != 4){
//Invalid number of arguments
cout << "invalid number of arguments" << endl;
return 1;
}
string* alphabet = new string(argv[1]);
string* message = new string(argv[2]);
string* operation = new string(argv[3]);
return 0;
}
好,謝謝你指出了那些我不知道的構造函數是在聲明。 – helpmee