-
Notifications
You must be signed in to change notification settings - Fork 33
/
stock.cpp
executable file
·39 lines (30 loc) · 1.28 KB
/
stock.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//*****************************************************************************************************
//
// The implementation of the Stock class header file.
//
// Other files required:
// 1. stock.h - header file for the Stock class
//
//*****************************************************************************************************
#include "stock.h"
#include <iostream>
//*****************************************************************************************************
Stock::Stock(const std::string &name, const std::string &symbol, double price) {
companyName = name;
stockSymbol = symbol;
stockPrice = price;
}
//*****************************************************************************************************
Stock::Stock(const Stock &s) {
companyName = s.companyName;
stockSymbol = s.stockSymbol;
stockPrice = s.stockPrice;
}
//*****************************************************************************************************
std::ostream &operator<<(std::ostream &out, const Stock &stock) {
out << stock.companyName << std::endl
<< stock.stockSymbol << std::endl
<< stock.stockPrice;
return out;
}
//*****************************************************************************************************