//DISPLAY 15.12 Use of a Virtual Function //Demonstrates the performance of the virtual function bill. #include #include "sale.h" //Not really needed, but safe due to ifndef. #include "discountsale.h" using namespace std; using namespace salesavitch; 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; }