Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started