//Demonstrates the performance of the virtual function bill. #include #include "sale.h" //Not really needed, but safe due to ifndef. #include "discountsale.h" using std::cout; using std::endl; using std::ios; using namespace SavitchSale; int main( ) { Sale simple(10.00);//One item at $10.00. DiscountSale discount(11.00, 10);//One item at $11.00 with a 10% discount. cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); if (discount < simple) { cout << "Discounted item is cheaper.\n"; cout << "Savings is $" << simple.savings(discount) << endl; } else cout << "Discounted item is not cheaper.\n"; return 0; }