Starting Out with C++: Early Objects
Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 15, Problem 20RQE

Soft Skills

22. Suppose that you need to have a class that can sort an array in ascending order or descending order upon request. If an array is already sorted in ascending or descending order, you can easily sort it the other way by reversing it. Now suppose you have two different classes that encapsulate arrays. One provides a member function to reverse its array, while the other provides a member function to sort its array. Can you use multiple inheritance to obtain a quick solution to your problem? Should you? Write a couple of paragraphs explaining whether using multiple inheritance will or will not work to solve this problem, and, if it can, whether this is a good way to solve the problem.

Blurred answer
Students have asked these similar questions
c++ Write a class called Triangle with three private integer data members a, b, and c as the lengths of its three edges. This class should have the following functions:  a constructor with three parameters representing the three edges a function isTriangle() which returns true if the three edges are all positive and they satisfy the triangle inequality where a+b> c, a+c> b, b+c> a, otherwise returns false. a function getPerimeter() which returns the perimeter of the triangle. (where, the perimeter = a+b+c)Then, test the above class in a program.
Write code to create a class named as ‘Employee’ with attributes i.e. ID, Name, Designation, Qualification, Salary, Taken-Leaves, Allowed-Leaves and the functions applyLeave().  This function will take number of leaves as an input and check Allowed-Leaves to see whether the employee can take leaves or not. If he can take, deduct these leaves from Allowed-Leaves and add in Taken-Leaves. Otherwise show message ‘you cannot take leave’.  Create another class ‘Intern’ and inherit ‘Employee’ as super class.
This lab will exercise your understanding of some of the concepts covered in Chapter 13:overloading operators   1. Create a class, name of your choice, to represent a college class in which students might register. a. Create three private member variables:Class Name (to hold values such as CSC210)Number of StudentsClass Hours b. Overload the >> operator to input, from cin, into the class object, the Class Name and Class Hours c. Overload the << operator to output all the private member variables d. Overload the + (plus) operator to add a value to the Number of Students private member variable.This will represent students registering for the class. e. Overload the - (minus) operator to subtract a value from the Number of Studentsprivate member variable. This will represent students dropping the class. f. The default constructor should initialize the private member variables appropriately. 2. Write a client program to: a. Upon program execution, create one class object that…

Chapter 15 Solutions

Starting Out with C++: Early Objects

Knowledge Booster
Background pattern image
Computer Science
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
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY