Cannot allocate objects of type _____ because the following virtual
functions are pure within ____
I'm new to C++ and can't seem to figure this one out. I'm working on
implementing classes for chain manipulations. The error is stemming from
these two classes:
Chain.h
//Chain.h file
#ifndef CHAIN_H
#define CHAIN_H
#include <iostream>
#include <sstream>
#include <string>
#include "Linearlist.h"
#include "chainNode.h"
using namespace std;
class chain : public linearList
{
public:
//Constructor, copy constructor, and destructor
chain(int initialCapacity);
//chain(const chain<T>&);
//~chain();
//Other Methods
virtual bool empty() const {return listSize==0;}
virtual int size() const {return listSize;}
virtual int* get(int theIndex) const;
virtual int indexOf(const int& theElement) const;
virtual void erase(int theIndex);
virtual void insert(int theIndex, const int& theElement);
virtual void traverse();
virtual void maxMin();
protected:
void checkIndex(int theIndex) const;
int* firstNode;
int listSize;
};
Linearlist.h
#ifndef linear_
#define linear_
#include <iostream>
using namespace std;
class linearList
{
public:
virtual ~linearList() {};
virtual bool empty() const = 0;
virtual int size() const = 0;
virtual int* get(int theIndex) const = 0;
virtual int indexOf(const int& theElement)const = 0;
virtual void erase(int theIndex) = 0;
virtual void insert(int theIndex,
const int& theElement) = 0;
virtual void traverse()=0;
virtual void MaxMin()=0;
// virtual void output(ostream& out) const = 0;
};
No comments:
Post a Comment