Define a class named Beverage Private Data Member: name - type string pointer (dynamic variable) Appropriate accessor and mutator functions. Default constructor and one argument constructor. Define...


Define a class named Beverage
Private Data Member: name - type string pointer (dynamic variable)
Appropriate accessor and mutator functions.
Default constructor and one argument constructor.
Define pure virtual output function.
Define a class named Soda derived from Beverage
Private Data Member: price - type double pointer (dynamic variable)
Appropriate accessor and mutator functions.
Default constructor and two argument constructor.
Override output function.
Define a class named Beer driven from Beverage
Private Data Member: alcohol_percentage - type double pointer (dynamic variable)
Appropriate accessor and mutator functions.
Default constructor and two argument constructor.
Override output function.



int main() {
Beverage *p,*q;
p = new Soda("Gatorade",1.99);
p->output(); // print "Name: Gatorade, Price: 1.99"
q = new Beer("Budweiser",3.6);
q->output(); // print "Name: Budweiser, Alcohol Percentage: 3.6"




Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here