I'm starting with C++ and maybe this isn't the best way to submit the question, just tell me if so.
I'm having a problem with two functions on GraphImp.h, I've implemented them on GraphImp.cpp and used the suggested firm from Visual Studio yet it won't recognize it, when I try to create a new graph it will tell me it's an abstract class.
GraphImp.h
#ifndef GRAPHIMP_H
#define GRAPHIMP_H
#include "Iterable.h"
#include "FuncionHash.h"
#include "FuncionCosto.h"
#include "Tupla.h"
#include "Array.h"
#include "Lista.h"
#include "ListaOrdEnc.h"
#include "Grafo.h"
#include "ColaPrioridad.h"
#include "FuncionCosto.h"
#include "Tabla.h"
#include "TablaAbierto.h"
typedef unsigned int nat;
template <class V, class A>
class GrafoImp : public Grafo<V, A>{
public:
Matriz<bool> AdyacentMatrix() const;
void LoadEdges(Puntero<ColaPrioridad <Tupla<V, V, A>, int>> cola, const FuncionCosto<V, A>& costo) const;
private:
...
};
#include "GraphImp.cpp"
#endif
GraphImp.cpp:
#ifndef GRAFOIMP_CPP
#define GRAFOIMP_CPP
#include "GrafoImp.h"
template<class V, class A>
Matriz<bool> GrafoImp<V, A>::AdyacentMatrix() const
{
Matriz<bool> output = Matriz<bool>(vertices.ObtenerLargo());
foreach(Tupla<V, V, A> arista, aristas->ObtenerIterador()) {
int i = this->ObtenerIndice(arista.ObtenerElemento1());
int j = this->ObtenerIndice(arista.ObtenerElemento2());
output[i][j] = true;
}
return output;
}
template<class V, class A>
void GrafoImp<V, A>::LoadEdges(Puntero<ColaPrioridad<Tupla<V, V, A>, int>> cola, const FuncionCosto<V, A>& costo) const{
...
}
Graph.h
#ifndef GRAPH_H
#define GRAPH_H
#include "Iterable.h"
#include "FuncionHash.h"
#include "FuncionCosto.h"
#include "Tupla.h"
#include "Array.h"
#include "Lista.h"
#include "ListaOrdEnc.h"
#include "Matriz.h"
#include "ColaPrioridad.h"
enum TipoConexo
{
NO_CONEXO, DEBILMENTE_CONEXO, FUERTEMENTE_CONEXO
};
typedef unsigned int nat;
template <class V, class A>
class Graph abstract
{
public:
...
virtual Matriz<bool> AdyacentMatrix() const abstract;
virtual void LoadEdges(Puntero<ColaPrioridad <Tupla<V, V, A>, int>> cola, const FuncionCosto<V, A>& costo) const abstract;
};
#endif
Sorry about the spanish, I've translated the essentials so I think it will be legible ;)