我在下面的标题中遇到了构造函数签名的问题。编译器给了我信息:
错误:在 '*' 标记之前应为 ')'
谁能告诉我这里可能缺少什么?
#ifndef PRIORITYQUEUE_H
#define PRIORITYQUEUE_H
#include <iostream>
#include <cstdlib> //We'll need to use srand() and rand() as well as clock()
#include <ctime>
#include <vector>
#include <list>
#include "Graph.h" //header for Graph class
using namespace std;
class PriorityQueue
{
public:
PriorityQueue(Graph*):infiniteDist(9999);
void set_previous_node(int, int);
int get_node_value(int);
void set_node_value(int, int); //Change the node value of an element
void markVisited(int);
bool contains(int); //Does the queue contain a particular vertex?
void insertIntoQueue(int);
int top(); //pick an unvisited node with the shortest distance.
int queueSize();
void print();
private:
class vertexNode {
public:
int nodeNum;
int nodeValue;
int previousNode; //previous node visited with shortest distance from source
bool wasVisited;
};
vector<vertexNode> nodeValues;
const int infiniteDist; //value to represent infinite distance
int nodeQuantity;
};
#endif // PRIORITYQUEUE_H
实际的构造函数用于:
PriorityQueue::PriorityQueue(Graph* graph):infiniteDist(9999)
{
...
}