Some Inheritance Issues

Here is a class defenition:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef __SHORTEST_PATH_H__
#define __SHORTEST_PATH_H__

#include "graph.h"
#include <iostream>
using namespace std;

template <class T>
class ShortestPath : public Graph<T>
{
public:
   explicit ShortestPath();
   explicit ShortestPath(directedType);
   explicit ShortestPath(weightedType);
   explicit ShortestPath(directedType, weightedType);
   explicit ShortestPath(weightedType, directedType);
   void outputShortestPath( const T& obj1, const T& obj2);
};


Here is the block of code that is producing an error (I have similar constructors that are duplicating the same error):
1
2
3
4
template <class T>
ShortestPath<T>::ShortestPath(directedType directedOpton) : Graph(directedOption)
{
}//End Constructor] 


and are here the errors that I am being troubled by:
" shortestPath.h:49:61: error: class ‘ShortestPath<T>’ does not have any field named ‘Graph’ "
" shortestPath.h:49:67: error: ‘directedOption’ was not declared in this scope "

Aaannnnd, here is why I am confused:

First, my professor used the example of calling a constructor from a parent class to set values, rather than relying on protected values and rebuilding the wheel. I also used that syntax in a previous assignment, and it worked.

Second, directedOption should be declared because it is the argument being passed to the constructor... at least this is how I interpreted it.
directedType is an enum from my "graph.h" file.

So, can someone help me point out my lapse in comprehension? Hopefully I provided enough information. Thank You!
Graph(directedOption) → Graph<T>(directedOption)
When dealing with compiler errors, fix top one first. Others probably will gone away whan you fix it.
Last edited on
Thank you, fixed the errors.
The reason why the second error existed was because I misspelled directedOption.

I really appreciate the help!
Topic archived. No new replies allowed.