Question
A) Consider the class, derived class, and the virtual function as shown in Display for Q3. Create a derived class (of sale) called MailorderSale having
A) Consider the class, derived class, and the virtual function as shown in Display for Q3. Create a derived class (of sale) called MailorderSale having one private member variable called shipping card. It should have constructor function and virtual function bill (this function adds shipping charge to the price). Define all these functions (no need for default constructors).
B) In the main function, define one object of Discount Sale with (11, 10) initial values and define another object of MailorderSale with (8,2) initial values. Then write statements to compare their bills using overloaded operator
Display for Q3. Interface for the Base Class Sale This is the header file sale. h. This is the interface for the class Sale. Sale is a class for simple sales. #ifndef SALE H #define SALE H #include ki ostream using namespace std; namespace sale savitch C Tass Sale pub Tic: Sale CD; Sale (doub 7e the price) virtua 7 double bi 11 O Const double savings Sale& other) const; calling object. Returns the savings if you buy other instead of the protected: double price boo T operator Cconst Sale& first, const Sale& second Compares two sa Tes to see which is Targer sa Tesa vitch Mendi f SALE H
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started