Template class inheriting a templated class

Hey everyone!
I'm hoping someone can point out what I'm doing wrong, I'm completely stuck. I'm making a minimal spanning tree class that inherits a graph class, both are templated.
This is my mstree.h so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef _MSTREE_H_
#define _MSTREE_H_

#include "graph.h"

namespace MSTreeNameSpace
{
  template <class T>
  class MSTREE : public Graph<T>
  {
  public:
    MSTREE(Graph); // constructor
    ~MSTREE(); 
    void output();
  };
};


and I keep getting these errors:

mst.h:9:25: error: expected template-name before ‘<’ token
class MST : public Graph<T>
^
mst.h:9:25: error: expected ‘{’ before ‘<’ token
mst.h:9:25: error: expected unqualified-id before ‘<’ token

Any help would be greatly appreciated!
Is the name Graph at namespace scope either in the global namespace or in the namespace MSTreeNameSpace?
I can't believe I forgot to add the GraphNameSpace:
1
2
3
4
#include "graph.h"

using namespace GraphNameSpace;
namespace MSTNameSpace


It's working great now.
Thanks for the help!!
Last edited on
using namespace GraphNameSpace; // **** avoid at global namespace scope, particularly in a header.

Favour one of these:

1
2
3
4
namespace MSTreeNameSpace
{
     using namespace GraphNameSpace ;
     // ... 


Or (better)
1
2
3
4
namespace MSTreeNameSpace
{
     using GraphNameSpace::Graph ;
     // ... 


Or (best)
1
2
3
4
namespace MSTreeNameSpace
{
    template <class T>
    class MSTREE : public GraphNameSpace::Graph<T>     // ... 


If we (ie. non-Redmond, non-Hungarian people) don't name a double holding the maximum temperature as either max_temperature_double or worse, double_max_temperature, should we name a namespace containing graph utilities as GraphNameSpace?
Topic archived. No new replies allowed.