Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
modify debug function of derived class
  • Loading branch information
LvChong committed Sep 22, 2014
1 parent 12fef81 commit 54b48bc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ch15/ex15.11/bulk_quote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ double Bulk_quote::net_price(std::size_t n) const

void Bulk_quote::debug() const
{
std::cout << "data members of this class:\n"
<< "min_qty= " << this->min_qty << " "
<< "discount= " << this->discount<< " \n";
Quote::debug();
std::cout << "min_qty= " << this->min_qty << " "
<< "discount= " << this->discount<< " ";
}
2 changes: 1 addition & 1 deletion ch15/ex15.11/bulk_quote.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef BULK_QUOTE_H
#define BULK_QUOTE_H
#include <quote.h>
#include"quote.h"

class Bulk_quote : public Quote
{
Expand Down
6 changes: 3 additions & 3 deletions ch15/ex15.11/limit_quote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

void Limit_quote::debug() const
{
std::cout << "data members of this class:\n"
<< "max_qty= " << this->max_qty << " "
<< "discount= " << this->discount<< " \n";
Quote::debug();
std::cout << "max_qty= " << this->max_qty << " "
<< "discount= " << this->discount<< " ";
}
8 changes: 7 additions & 1 deletion ch15/ex15.11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ int main()
*/
Quote& r = q;
r.debug();
std::cout << "\n";
r = bq;
r.debug();
std::cout << "\n";
r = lq;
r.debug();
std::cout << "\n";


std::cout << "====================\n";
Expand All @@ -54,10 +57,13 @@ int main()
*
*/
print_debug(q);
std::cout << "\n";
print_debug(lq);
std::cout << "\n";
print_debug(bq);
std::cout << "\n";


system("pause");
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.11/quote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ void Quote::debug() const
{
std::cout << "data members of this class:\n"
<< "bookNo= " <<this->bookNo << " "
<< "price= " <<this->price<< " \n";
<< "price= " <<this->price<< " ";
}

0 comments on commit 54b48bc

Please sign in to comment.