Hello I am new to this forum so hello everyone!
I have a problem with as it seems to be a compile error when trying to inherit a class from one header file to another. Here is part of the code i think might be the problem:
#ifndef SORTEDLINKEDLIST_H
#define SORTEDLINKEDLIST_H
#include <iostream>
#include "LinkedListType.h"
using namespace std;
template <typename ItemType>
class SortedLinkedList: public LinkedListType<ItemType>
{
public:
// Constructor
SortedLinkedList();
...
I'm pretty sure its this line:
class SortedLinkedList: public LinkedListType<ItemType>
thats causing the problem because i'm getting the error:
/Users/salgarcia/Desktop/hmmm/SortedLinkedList.h:54:0 /Users/salgarcia/Desktop/hmmm/SortedLinkedList.h:54: error: class 'SortedLinkedList<ItemType>' does not have any field named 'LinkedListType'
...when i try to implement these functions:
//**************************************************************
template <typename ItemType>
SortedLinkedList<ItemType>::SortedLinkedList()
:LinkedListType()
{}
//**************************************************************
template <typename ItemType>
SortedLinkedList<ItemType>::SortedLinkedList
(const SortedLinkedList<ItemType>& otherList)
:LinkedListType(otherList)
{}
...please let me know if the inheritance coding is correct or if there is something in Xcode i need to change because it works perfectly in visual studios.
Thank you!
I have a problem with as it seems to be a compile error when trying to inherit a class from one header file to another. Here is part of the code i think might be the problem:
#ifndef SORTEDLINKEDLIST_H
#define SORTEDLINKEDLIST_H
#include <iostream>
#include "LinkedListType.h"
using namespace std;
template <typename ItemType>
class SortedLinkedList: public LinkedListType<ItemType>
{
public:
// Constructor
SortedLinkedList();
...
I'm pretty sure its this line:
class SortedLinkedList: public LinkedListType<ItemType>
thats causing the problem because i'm getting the error:
/Users/salgarcia/Desktop/hmmm/SortedLinkedList.h:54:0 /Users/salgarcia/Desktop/hmmm/SortedLinkedList.h:54: error: class 'SortedLinkedList<ItemType>' does not have any field named 'LinkedListType'
...when i try to implement these functions:
//**************************************************************
template <typename ItemType>
SortedLinkedList<ItemType>::SortedLinkedList()
:LinkedListType()
{}
//**************************************************************
template <typename ItemType>
SortedLinkedList<ItemType>::SortedLinkedList
(const SortedLinkedList<ItemType>& otherList)
:LinkedListType(otherList)
{}
...please let me know if the inheritance coding is correct or if there is something in Xcode i need to change because it works perfectly in visual studios.
Thank you!