Why am I getting this error?
I have a Graph.h file....
Code:
#ifndef GRAPH_H_
#define GRAPH_H_
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <list>
#include <map>
#include "GraphStuff.h"
struct Vertex;
class Graph
{
public:
Graph( ) { }
~Graph( );
void addEdge( const std::string & sourceName, const std::string & destName, double cost );
void printPath( const std::string & destName ) const;
void unweighted( const std::string & startName );
void dijkstra( const std::string & startName );
void addVertex (const string & startName);
private:
Vertex * getVertex( const std::string & vertexName );
void printPath( const Vertex & dest ) const;
void clearAll( );
typedef map<std::string,Vertex *,less<std::string> > vmap;
// Copy semantics are disabled; these make no sense.
Graph( const Graph & rhs ) { }
const Graph & operator= ( const Graph & rhs )
{ return *this; }
vmap vertexMap;
};
#endif /*GRAPH_H_*/
and a Movie.h file....
Code:
#ifndef MOVIE_H_
#define MOVIE_H_
#include <string>
#include <vector>
#include "ActorDB.h"
#include "Graph.h"
#include "GraphStuff.h"
class Actor;
/**
* A class that represents a Movie. These objects contain the movie
* title, the year the movie was released, and a cast list.
*/
class Movie
{
public:
Movie();
/**
* Build a new movie.
*
* @param t The title of the movie
* @param y The year string for this movie
* @param a A pointer to the ActorDB object. The movie stores actor tags
* taken from this object.
*
*/
Movie(const std::string& t, const std::string& y, ActorDB* a = 0);
/// return the title of the movie
std::string title() const;
/// returns the year in which the movie was made.
std::string year() const;
/**
* Add an actor to the movie's cast list. Takes a tag from the actor database
* as input. Note that it's marked "const" -- the cast list does not participate
* in the ordering of Movies; two Movies are logically equal if their titles and years
* are equal. Thus, the cast list is a mutable member of the Movie.
*
* @param a a tag referring to an actor to add to the list. To dereference such a tag,
* we have to pass it back to the ActorDB object it came from.
*/
void add_actor(ActorDB::tag a) const;
/**
* Returns a vector of Actors, the cast of this movie.
*
* @return a vector of copies of the Actors with roles in this movie.
*/
std::vector<Actor> cast() const;
void actorConnections(ActorDB::tag a) const;
void printPath(const string & name1, const string & name2);
private:
/// A pointer to the ActorDB that stores the actors with roles in this movie.
/// Used to resolve the ActorDB::tag objects that we store.
ActorDB* adb;
/// The title of this movie.
std::string the_title;
/// The year in which this movie was released.
std::string the_year;
/// A vector of ActorDB::tag objects, referring to the Actor objects
/// stored in *adb that represent our cast.
mutable std::vector<ActorDB::tag> the_cast;
///The private graph for the Kevin Bacon Problem
mutable Graph actorGraph;
};
#endif /*MOVIE_H_*/
However, I am getting an error in the Graph.h file. It says "error: Graph::Graph(const Graph&) is private"
Does anybody know why I'm getting this error?