I have another question regarding adding contents in the stl linked lists. For my class definition below:
Code:
#include <string>
#include <vector>
#include <exception>
#include <list>
using namespace std;
#ifndef __Job_List_h__
#define __Job_List_h__
#include "Receptionist.h"
#include "Technician.h"
namespace Main_Class_Diagram
{
class Receptionist;
class Technician;
class Job_List;
}
namespace Main_Class_Diagram
{
struct Item
{
int PartNumber;
int Quantity;
int Cost;
};
struct LabourItem
{
int LabourType;
int Cost;
};
}
namespace Main_Class_Diagram
{
class Job_List
{
private: Main_Class_Diagram::Receptionist* _unnamed_Receptionist_;
private: Main_Class_Diagram::Technician* _unnamed_Technician_;
private: list <Item> PartOrders;
list <LabourItem> LabourOrders;
public: void AddItem(int PartNumber, int Quantity, int Cost);
public: void AddLabourItem(int Labour, int Cost);
public: void PrintInvoice();
void NewInvoice();
};
}
#endif
Let's say that I want to implement the AddItem function:
Code:
#include <iostream>
#include <string>
#include <vector>
#include <exception>
#include <list>
using namespace std;
#include "Job_List.h"
#include "Receptionist.h"
#include "Technician.h"
void Main_Class_Diagram::Job_List::AddItem(int PartNumber, int Quantity, int Cost) {
PartOrders.push_back();
PartOrders.PartNumber = PartNumber;
PartOrders.Cost = Cost;
PartOrders.Quantity = Quantity;
}
For some reason, I can't access the highlights in my IDE to the struct components properly. Does anyone know whether I'm accessing the struct components of PartOrders properly? How would I store those values into the struct contents properly?