Home Activity Consider the class class base { public: virtual void iam) { cout << "base\n"; }; Derive two classes from class base, and for each define iam() to write out the a. name of the class. b. Declare objects of each class, and call iam) from them. c. iam() through the pointers. Assign the address of objects of the derived classes to base pointers and call d. Remove the virtual keyword from the base class member function, run your code again, and compare the results.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Please solve solve asap. It is c++ program.
Home Activity
Consider the class class base
{
public:
virtual void iam0
{
cout << "base\n";
}
};
a.
Derive two classes from class base, and for each define iam() to write out the
name of the class.
b.
Declare objects of each class, and call iam) from them.
с.
Assign the address of objects of the derived classes to base pointers and call
iam() through the pointers.
d.
Remove the virtual keyword from the base class member function, run your code
again, and compare the results.
Develop a simple payroll application. There are three kinds of employees in the system:
salaried employee, hourly employee, and commissioned employee. The system takes as
input an array containing employee objects, calculates salary polymorphically, and
generates report.
Make Employee an abstract class. Declare salary) and display() as pure virtual
functions in it. Derive salaried employee (monthly), hourly employee (per hour basis), and
commissioned employee (bonus on completing each target) from base class Employee. The
display() function should show employee no, employee name, and salary of all employees.
Create a base class called shape. Use this class to store two double type values that could
be used to compute the area of figures. Derive two specific classes called triangle and
rectangle from the base shape. Add to base class, a member function get_data() to initialize
base class data members and another member functions display_area() to compute and
display the area of figures. Mark the display_area() as a virtual function and redefine this
function in the derived class to suit their requirements.(Use pure virtual function)
Transcribed Image Text:Home Activity Consider the class class base { public: virtual void iam0 { cout << "base\n"; } }; a. Derive two classes from class base, and for each define iam() to write out the name of the class. b. Declare objects of each class, and call iam) from them. с. Assign the address of objects of the derived classes to base pointers and call iam() through the pointers. d. Remove the virtual keyword from the base class member function, run your code again, and compare the results. Develop a simple payroll application. There are three kinds of employees in the system: salaried employee, hourly employee, and commissioned employee. The system takes as input an array containing employee objects, calculates salary polymorphically, and generates report. Make Employee an abstract class. Declare salary) and display() as pure virtual functions in it. Derive salaried employee (monthly), hourly employee (per hour basis), and commissioned employee (bonus on completing each target) from base class Employee. The display() function should show employee no, employee name, and salary of all employees. Create a base class called shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to base class, a member function get_data() to initialize base class data members and another member functions display_area() to compute and display the area of figures. Mark the display_area() as a virtual function and redefine this function in the derived class to suit their requirements.(Use pure virtual function)
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education