내 코드에 오류가 있습니다 (오류 C2512 : '노드': 적절한 기본 생성자를 사용할 수 없음) 하지만 기본 생성자가 있습니까 ??? 코드에서 주석 내 오류 위치는 나에게오류 C2512하지만 기본 생성자를 사용할 수
Node.h
도와주세요#pragma once
#include "stat.h"
#include "Automata.h"
#include <cstdlib>
class Node
{
friend class Automata;
friend class stat_a;
friend stat_a* makeauto(char *str);
friend int main();
private:
stat_a* mess;
char data;//harfi ke ba in masir estefadeh mishe :)
Node *next;//node badi dar araye node ha class stat_a :)
public:
Node()
{
mess = NULL;
next = NULL;
};
};
stat.h
#pragma once
#include "Node.h"
#include <iostream>
using namespace std;
class stat_a
{
friend class Automata;
friend class Node;
friend int main();
private:
bool is_final_stat_a; //aya final stat_a hast ???
int stat_a_num; //shomareh halat 0,1,2,...
Node *last; //akharin node dar araye node haye neshan dahande masir
Node *first; //Avalin node dar araye node haye neshan dahande masir
public:
void add(char d,stat_a * a)//ezafeh kardan masiri ke ba estefadeh
{ //az harf (char d) be halat (stat_a a) miravad
if(first == NULL)
{
first = new Node;//error is here
first->data = d;
first->mess = a;
last=first;
}
else
{
last->next = new Node ;//erorr is here
last=last->next;
last->data=d;
last->next=NULL;
last->mess=a;
}
};
/***********************************************************************/
void print()
{
cout<<stat_a_num<<"========> is final_stat_a : "<<is_final_stat_a<<endl;
Node *a;
a=first;
while(a != NULL)
{
cout<<"========> By '"<<a->data<<"' go to stat "<<a->mess->stat_a_num<<endl;
a=a->next;
}
};
stat_a()
{
last=NULL;
first=NULL;
is_final_stat_a=false;
};
~stat_a(void);
};
나는 기본 생성자를 사용할 이유 오류
당신이 유래에 도움을 요청합니다 해당 지역의 언어 다음 번에 삭제하시기 바랍니다 의견
이, 그것은 언어에 익숙하지 않은 사람들을 위해 단지 소음의 교체 진짜 문제를 산만하게한다. – SpongeBobFan
순환 포함 종속성이 있습니다. 그건 안돼. – juanchopanza
지나치게 친구를 사귀지 말고, 정말로 필요할 때만 지키십시오 (99.99 %의 경우는 절대 안됨). –