Good afternoon Daniweb, I have a simple (and probably idiotic) problem today, I have a simplistic program that simulates a Train station, trains come in, they go into a stationDock and come out after a while.
The stationDocks are an array of trains, either pointing to a train or being NULL (at least that's what it should be, I probly did an error somewhere in the implementation)
WideVar.cpp: In static member function ‘static void wideVar::freeDock(int)’:
WideVar.cpp:67: error: no match for ‘operator=’ in ‘*(((Train*)(((unsigned int)i) * 36u)) + wideVar::stationDocks) = 0’
Train.h:7: note: candidates are: Train& Train::operator=(const Train&)
WideVar.cpp: In static member function ‘static bool wideVar::dockIsEmpty(int)’:
WideVar.cpp:69: error: no match for ‘operator==’ in ‘*(((Train*)(((unsigned int)i) * 36u)) + wideVar::stationDocks) == 0’
WideVar.cpp: In static member function ‘static void wideVar::setDock(int, Train*)’:
WideVar.cpp:71: error: no match for ‘operator=’ in ‘*(((Train*)(((unsigned int)i) * 36u)) + wideVar::stationDocks) = train’
Train.h:7: note: candidates are: Train& Train::operator=(const Train&)
WideVar.cpp: In static member function ‘static int wideVar::compareDock(int, Train*)’:
WideVar.cpp:73: error: base operand of ‘->’ has non-pointer type ‘Train’
WideVar.cpp:73: error: expected `}' at end of input
P.S. I commented out (only in the example) the parts of the code unrelated to the problem.
#include <stdlib.h>
#include "WideVar.h"
extern int STATION_ROOM;
extern int TRAIN_START_ID;
/*
static LinkedList eventList = LinkedList();
static LinkedList trainList = LinkedList();
static Queue inQueue = Queue();
static Queue outQueue = Queue();
*/
static int dockLength = STATION_ROOM;
static int freeDocks = dockLength;
static Train* stationDocks = new Train[dockLength];
static int trainIdStart = TRAIN_START_ID;
/*
void wideVar::insertEvent(Event* newIS)
{eventList.insert(newIS);}
bool wideVar::checkEmptyEvent()
{return eventList.isEmpty();}
Event* wideVar::returnTopEvent()
{return dynamic_cast<Event*>(eventList.Top->item);}
void wideVar::removeTopEvent()
{eventList.removeTop();}
void wideVar::printTrains()
{trainList.print(); }
void wideVar::destroyTrains()
{trainList.~LinkedList();}
void wideVar::destroyEvents()
{eventList.~LinkedList();}
void wideVar::inPush(Train* train)
{inQueue.push(train);}
Train* wideVar::inPop()
{return (Train*) inQueue.pop();}
Train* wideVar::inPeek()
{return (Train*) inQueue.peek();}
int wideVar::getInLength()
{return inQueue.getLength()}
void wideVar::outPush(Train* train)
{outQueue.push(train);}
Train* wideVar::outPop()
{return (Train*) outQueue.pop();}
Train* wideVar::outPeek()
{return (Train*) outQueue.peek();}
int wideVar::getOutLength()
{return inQueue.getLength();}
void wideVar::destroyIn()
{inQueue.~Queue();}
void wideVar::destroyOut()
{outQueue.~Queue();}
int wideVar::trainId()
{return trainIdStart++;}
void wideVar::freeDocksNumDown()
{freeDocks--;}
void wideVar::freeDocksNumUp()
{freeDocks++;}
int wideVar::freeDocksReturn()
{return freeDocks;}
*/
void wideVar::freeDock(int i)
{stationDocks[i] = NULL;}
bool wideVar::dockIsEmpty(int i)
{return stationDocks[i] == NULLz;}
void wideVar::setDock(int i, Train* train)
{stationDocks[i] = train;}
int wideVar::compareDock(int i, Train* train)
{return stationDocks[i]->compareTo(train);
Thank you very much for your help!