QtDesignPatterns/commandpattern/stock.h

21 lines
411 B
C
Raw Normal View History

2024-02-06 17:21:37 +08:00
#include <string>
#include <iostream>
using namespace std;
class Stock
{
public:
void buy()
{
cout << "Stock [ Name: " + name + ", Quantity: " + std::to_string(quantity) + " ] bought" << endl;
}
void sell()
{
cout << "Stock [ Name: " + name + ", Quantity: " + std::to_string(quantity) + " ] sold" << endl;
}
private:
string name = "test";
int quantity = 10;
};