-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathex15_27_Bulk_quote.h
More file actions
35 lines (24 loc) · 847 Bytes
/
ex15_27_Bulk_quote.h
File metadata and controls
35 lines (24 loc) · 847 Bytes
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
/*
=================================================================================
C++ Primer 5th Exercise Answer Source Code
Copyright (C) 2014-2015 https://github.com/pezy/Cpp-Primer
Bulk_quote
inherited constructors from EX15::Disc_quote
If you have questions, try to connect with me: pezy<urbancpz@gmail.com>
=================================================================================
*/
#ifndef CP5_EX15_27_BULK_QUOTE_H
#define CP5_EX15_27_BULK_QUOTE_H
#include "ex15_15_Disc_quote.h"
inline namespace EX27 {
using std::string;
class Bulk_quote : public Disc_quote {
public:
using Disc_quote::Disc_quote;
virtual double net_price(std::size_t cnt) const override {
if (cnt >= quantity) return cnt * (1 - discount) * price;
else return cnt * price;
}
};
}
#endif // CP5_EX15_27_BULK_QUOTE_H