Files

36 lines
940 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef COSMETIC_H
#define COSMETIC_H
#include <string>
#include <ctime>
class Cosmetic {
public:
Cosmetic(std::string name = "", double price = 0.0, bool type = true, std::string expirationDate = "");
// Getter方法
std::string getName() const;
double getPrice() const;
bool getType() const;
std::string getExpirationDate() const;
// Setter方法
void setName(std::string name);
void setPrice(double price);
void setType(bool type);
// 设置过期日期
void setExpirationDate(std::string expirationDate);
// 获取当前时间
static std::string getTime();
// 获取当前时间+days天
static std::string getTimeAdd(int days = 60);
private:
std::string name; // 品牌名称
double price; // 单价
bool type; // 类型true:国产, false:进口)
std::string expirationDate; // 新增过期日期成员
};
#endif // COSMETIC_H