So I have a "base" class called "SortData". When I try to allow my other header file "InsertionSort.h" inherit this base class, I keep getting a class type redefinition error. What am I doing wrong?

Here's the base class header:

// SortData.h

#include <iostream>

using namespace std;

class SortData
	SortData(int max=100);

	int size() const;
	void randomize(int seed = 1);
	void printSome(const int num=10) const;

	virtual _int64 sort() = 0;

	long *theData;
	int maxSize;

And here's the header that's trying to inherit this base class:

// InsertionSort.h

#include "SortData.h"

class InsertionSort : public SortData
	InsertionSort(int max=100);
	_int64 sort();

	_int64 numops;
	void insertionSort(long theArray[], int n);

Are you including both in main.cpp? This could be your problem and the solution is to use preprocessor blockers


#ifndef SORTDATA_H
#define SORTDATA_H

class SortData



And do the same thing for InsertionSort.h but with a different blocker name

Yeah I just realized that...sorry for the waste of forum space :(