Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ pleaese helps file Sortable.h . It contains an abstract data type called Sortable which will act as a base class for any object a

C++ pleaese helps

file Sortable.h. It contains an abstract data type called Sortable which will act as a base class for any object a collection of which can be sorted. It has two virtual methods, compare and print. The compare method tells the object how to compare itself with another object. It returns true if the object it is being called from is smaller than the other object. The print method allows the object to display itself.

Modify your Data class so that it operates on Sortable objects instead of int objects. Recall from the textbook that we can not allocate abstract data types. Therefore, in order to accomplish the task in this exercise, you will need to use pointers.

Also, you are not provided with any .cpp files in order to test your code. Testing your code will involve creating a class that extends Sortable and pushing some objects of that class into your Data object and trying to sort and print them. This is the goal of the next exercise.

#ifndef LA6_Sortable_h #define LA6_Sortable_h class Sortable { public: virtual bool compare (const Sortable * s) = 0; virtual void print () = 0; }; #endif 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Answered: 1 week ago

Answered: 1 week ago