#include <iostream>
using namespace std;
typedef int vertex;
enum vertexstate { white, gray, black };
class graph
{
private:
bool**adjacencymatrix;
int vertexcount;
public:
graph(int vertexcount);
~graph();
void addedge(int i, int j);
void removeedge(int i, int j);
bool isedge(int i, int j);
void display();
void Dfs();
void runDfs(int u, vertexstate state[]);
};
graph::graph(char filename[], int vertexcount) //error is here
{
this->vertexcount = vertexcount;
adjacencymatrix = new bool*[vertexcount];
for (int i = 0; i<vertexcount; i++)
{
adjacencymatrix[i] = new bool[vertexcount];
for (int j = 0; j<vertexcount; j++)
adjacencymatrix[i][j] = false;
}
how to fix: "out of line definition of 'graph' does not match any declaration in 'graph'"
2.1k Views Asked by Penrose5833 At
1
Apart from your code sample being incomplete and you not really formulating a question....
Your constructor is defined as
graph(int vertexcount);
yet your implementation uses different parameters:graph(char filename[], int vertexcount)
.You have 2 possibilities depending on what you are tryin to achieve:
1) You can change the definition in your class to
graph(char filename[], int vertexcount)
2) You can change your implementation to read like this:#
In case you need filename: I would recommend to use
const std::string&
as parameter type - or at leastconst char*
...