forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bulk_quote.h
54 lines (40 loc) · 1.36 KB
/
bulk_quote.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef BULK_QUOTE_H
#define BULK_QUOTE_H
#include "disc_quote.h"
class Bulk_quote : public Disc_quote
{
public:
Bulk_quote() { std::cout << "default constructing Bulk_quote\n"; }
Bulk_quote(const std::string& b, double p, std::size_t q, double disc) :
Disc_quote(b, p, q, disc) { std::cout << "Bulk_quote : constructor taking 4 parameters\n"; }
// copy constructor
Bulk_quote(const Bulk_quote& bq) : Disc_quote(bq)
{ std::cout << "Bulk_quote : copy constructor\n"; }
// move constructor
//page 535, " In a constructor, noexcept appears between the parameter list and the : that begins the constructor initializer list"
Bulk_quote(Bulk_quote&& bq) noexcept : Disc_quote(std::move(bq))
{
std::cout << "Bulk_quote : move constructor\n";
}
// copy =()
Bulk_quote& operator =(const Bulk_quote& rhs)
{
Disc_quote::operator =(rhs);
std::cout << "Bulk_quote : copy =()\n";
return *this;
}
// move =()
Bulk_quote& operator =(Bulk_quote&& rhs) noexcept
{
Disc_quote::operator =(std::move(rhs));
std::cout << "Bulk_quote : move =()\n";
return *this;
}
double net_price(std::size_t n) const override;
void debug() const override;
~Bulk_quote() override
{
std::cout << "destructing Bulk_quote\n";
}
};
#endif // BULK_QUOTE_H