I think were almost there, this is a real opener and very informative thanks once again. There seems to be only a couple of things the compiler doesn't like now.
#include <iostream.h>#include <string>#include "classes.h"using namespace std;Tray *tray_prod_init() { Tray *t_array = new Tray[10];//'Tray' : no appropriate default constructor available //I'm presuming that I should use a similar def constructor to //the one we used for the product??? //Set up List of Products Product mars("Mars",40); Product Snickers("Snickers",40); Product Wispa("Wispa",35); Product Aero("Aero",40); Product Yorki("Yorki",40); Product Galaxy("Galaxy",40); And the second half //Set up List of trays Tray A1("A1",mars); Tray A2("A2",Snickers); Tray A3("A3",Wispa); Tray A4("A4",Aero); Tray A5("A5",Yorki); Tray A6("A6",Galaxy); //Assign position in array for each tray Tray[0] = mars;//syntax error : missing ';' before '[' Tray[1
] = Snickers;//syntax error : missing ';' before '['
Tray[2] = Wispa;//syntax error : missing ';' before '['
Tray[3] = Aero;//syntax error : missing ';' before '['
Tray[4] = Yorki;//syntax error : missing ';' before '['
Tray[5] = Galaxy;//syntax error : missing ';' before '['
return t_array;
}
void main() {
Tray* tList = tray_prod_init(); // use tList
delete[] tList; // MAKE SURE YOU DO THIS WHEN YOU'RE DONE!!!
}
Edited by - pdstatha on January 3, 2002 8:36:11 AM
Edited by - pdstatha on January 3, 2002 8:38:04 AM
The text is there, just for some reason it's appeared in white so if you want to see it just highlight it by dragging your mouse.
Edited by - pdstatha on January 3, 2002 8:40:16 AM