Question: Your objective is to define the generic class named OrderedSet which represents a set with a maximum capacity of 100 where a set is a
Your objective is to define the generic class named OrderedSet which represents a set with a maximum capacity of 100 where a set is a collection of distinct objects. For the class, you must include the following:
A private generic Array field of size 100 that represents the set.
A private ulong field that represents the current size of the set.
A public default constructor that assigns 0 to the ulong field.
A public copy constructor.
A public assignment operator.
A public empty destructor.
A public void method named Insert() that takes a constant generic reference parameter. It adds the parameter to the set if it is not already a member of the set.
A public void method named Remove() that takes a constant generic reference parameter. It removes the element of the set that is equal to the parameter if the parameter is a member of the set.
A public bool constant method named IsFull() that takes no parameters. It returns true if the set is full; otherwise, it returns false.
A public bool constant method named IsEmpty() that takes no parameters. It returns true if the set is empty; otherwise, it returns false.
A public ulong constant method named Count() that takes no parameters. It returns the count of the set.
A public bool constant method named Contains() that takes a constant generic reference parameter. It returns
true if the parameter is a member of the set; otherwise, it returns false.
A public constant method named ToString() that takes no parameters. It returns a string of elements of the set separated by commas all enclosed in curly braces in ascending order.
A friend overloaded ostream operator. It displays the elements of the set in the same format as ToString().
please make code as simple as possible and explain each line.
c++
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
