Well Get() is working, get() however does not work.
This isnt the problem im quite sure.
Stock files below.
Code:
/////////////////////////
//Ryan Pincher
//Stock.cpp
//
//
//////////////////////////
#include <defs.h>
#include <iostream.h>
#include <conio.h>
#include <cstring.h>
#include "stock.h"
Stock::Stock()
{
StockNumber=" ";
Description=" ";
CurrentStock=0;
UnitSize=0;
UnitPrice=0;
MinStock=0;
};
Stock::Stock(string SN, string Dn, double CS, float US, float UP, double MS)
{
StockNumber=SN;
Description=Dn;
CurrentStock=CS;
UnitSize=US;
UnitPrice=UP;
MinStock=MS;
};
void Stock::Print(ostream& strm)
{
strm << "\nStock Number : " << StockNumber<< endl;
strm << "Description : " << Description << endl;
strm << "Current Stock : " << CurrentStock << endl;
strm << "Unit Size : " << UnitSize << endl;
strm << "Unit Price : " << UnitPrice << endl;
strm << "Minimum Stock : " << MinStock << endl;
}; // end Print()
ostream& operator<<(ostream& strm, Stock& S)
{
S.Print(strm);
return strm;
};
Code:
////////////////////////////////////////
// Ryan Pincher
// Stock.h
//
//////////////////////////////////////////
#include <defs.h>
#include <iostream.h>
#include <conio.h>
#include <cstring.h>
#ifndef STOCK_H
#define STOCK_H
class Stock
{
private:
//Attributes
string StockNumber;
string Description;
double CurrentStock;
float UnitSize;
float UnitPrice;
double MinStock;
public:
//Methods
Stock();
Stock(string SN, string Dn, double CS, float US, float UP, double MS);
virtual void Print(ostream& strm = cout);
string getStockNo();
string getDescription();
double getCurrStock();
float getUnitSize();
float getUnitPrice();
double getMinStock();
friend ostream& operator<<(ostream& strm, Stock& S);
};
#endif