I keep getting errors and i dont know what im doing wrong.I've included just pieces of these three files. The compiler is giving me errors and i dont know what's wrong.

this is my header file List.h not all but some of it.

#include <iostream>
using namespace std;


template <class T>
class List
  List(int sz);                   //Constructor create array with sz capacity

  //The big three
  ~List();                        //Destructor
  List(const List &initList);     //Copy constructor
List &operator=(const List &rightSide);  //Assigment operator

  //Name: getSize
  //Description:  returns the number of elements in the array
  //Parameteres:  none
  //Return:  number of elements in the array
  int getSize() const;

This is my implementation file list.cpp

#include "list.h"

#include <iomanip>
using namespace std;

template <class T >

List::List(int sz)                   //Constructor creates array with capacity sz

  numElements = sz;
  list = new T [sz];

This is my application file

#include "list.cpp"
#include "list.h"
#include <iostream>
#include <fstream>
using namespace std;

void initializeList(List<char> &array);
void printList(List<char> array);
void updateItem(List<char> &array);
int menu();

int main()
  List<char> myList(10);

thank you for responding.

okay so my header is okay.so in lines 6-12 i would put:

template <class T>
list= new int[sz];

Yes except for what is sz and where are you getting it from? Do you have all of your code in List.h now? What does your main .cpp file look like now?

This article has been dead for over six months. Start a new discussion instead.