あなたが私を助けてくれることを望んでいました。
この質問は (Google 検索を行った後) 何百万回も聞かれていることを知っています。私の問題の解決策は、何百万もの質問の 1 つにあると確信していますが、それを見つけることができなかったので、質問することにしました。
具体的には次のエラーが表示されます。
エラー 1 エラー C2512: 'NodeQueue': 適切な既定のコンストラクターがありません a:\work\fast\semi 5\automata\assignments\progass1\progass1\progass1\tree.h 33 1 progass1
特定の行には次の定義があります。
level=new NodeQueue<Node>;
次の行でも同じエラーが発生しますが、原因は同じです..
なぜこれが起こっているのかわからないすべてのデフォルトのコンストラクターがあります..コードの一部は次のとおりです。
ヘッダー ファイルの上部:
#include <iostream>
using namespace std;
#include "intarr.h"
class Node;
template <typename t>
class QueueNode;
template <typename t>
class NodeQueue;
木:
class Tree{
Node* root;
int level_length;
Node* curr;
NodeQueue <Node>* level,*level_bak;
public:
Tree(){
root=NULL;
level_length=0;
curr=NULL;
level=new NodeQueue<Node>;
level_bak=new NodeQueue<Node>;
}
// I doubt you need the rest...
クラスノード
class Node{
public:
Node *top,*right,*bottom,*left,*prev;
Node *a,*b,*c;
int row,col;
Node(){
}
Node(int x,int y){
top=right=bottom=left=prev=NULL;
row=x;col=y;
a=b=c=NULL;
}
};
queuenode (キューのノード)
template <typename t>
class QueueNode {
public:
QueueNode* next;
QueueNode* prev;
t *value;
QueueNode(){
}
QueueNode(t* value){
next=NULL;
this->value=value;
}
};
ノードキュー:
template <typename t>
class NodeQueue {
QueueNode *head;
QueueNode *tail;
//lhs=bottom;
public:
NodeQueue(){
head=NULL;
tail=NULL;
}
//....... rest of the code you dont need