Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class named Set (like Sets in Mathematics) having following private members: int *array_set; int size The class should have the following member functions:

Create a class named Set (like Sets in Mathematics) having following private members:

int *array_set;

int size

The class should have the following member functions:

Set () initializes empty object

Set (int s) initializes a dynamic array of size s with all elements equal to zero. This array represents our set.

Set (int *ref, int s) initializes the array to the ref array passed as argument having size s.

Set (const Set& obj) copy constructor

Overloaded + operator for union of two sets

Overloaded - operator for intersection of two sets

Overloaded == operator to see if two sets are equal (note that in sets, order of elements does not matter, so {1,2,3} and {3,2,1} are equal sets).

Overloaded >> operator to input all elements of a set

Overloaded << operator to print the entire set

~set ()

Write a testSet() function that creates multiple pointers of Set class that point to Set objects and tests all the functionalities above. Console must have a neat format. Call testSet() function in main().

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

For the two scores 8 and 12, XX)2 is: a.2 b.4 c.8 d.12

Answered: 1 week ago