This is how I had tried sending the vector using one of the answers I got., but has not worked out yet.Should copy whn it gets to auctioneer.I want to display.
class Trader {
private:
int nextBidId;
public:
void loadRange( vector <Bid> & bids ) {} ;
class Simulator //Receives from the Trader,doent modify
{
vector <Bid> bids;
Trader trader;
Auctioneer auctioneer;
public:
void run();
};
void Simulator::run() {
trader.loadRange(vector<Bid> & bids);
auctioneer.accept_bids(bid_vector::const_iterator begin, bid_vector::const_iterator end);
auctioneer.displayBids();
}
class Auctioneer // Has to receive from the simulator class
{
public:
vector <Bid> bids,v2;
void accept_bids(vector<Bid> & bids);
void displayBids(){cout << "\tBid\t(" << setw(3) << bids.bidId << "\t " << setw(3) << bids.trdId << "\t "
<< setw(3) << bids.type <<"\t " << setw(3) << bids.qty <<"\t " << setw(3)
<< bids.price <<")\t\n " ; }
};
UPDATE
I have just copied a vector from another class, am now trying to see its contednts.its returning an error:
Error: - begin has not been declared.how do I decalre bigin for the vector?
void Auctioneer::accept_bids(const BidList& bid){
vector<Auctioneer> *list;
vector<Auctioneer>::iterator itr; // create an iterator
for ( itr = list.begin();
itr != list.end(); ++itr )
cout << *itr << ' ';
}