Question: I'm having a problem with the set and reset functions of this assignment. The requirements are: My code is: I get this error at set():
I'm having a problem with the set and reset functions of this assignment. The requirements are:

My code is:

I get this error at set():

Define a class named Bits that holds a single integer variable. You will use this integer simply as a container of bits. The number of bits you can support depends on the type of integer you use. We will use an unsigned long long, which on most platforms occupies 64 bits. However, DO NOT HARD-CODE the type of integer you use throughout your code. You should be able to change only one line of code for your class to work with a different size integer (see the using statement on the second code line below). The code skeleton below gets you started, and also shows you the interface your class needs to implement class Bits { using IType = unsigned long long; enum {NBITS = sizeof(IType) *8}; IType bits = 0; public: Bits() = default; Bits (IType n) { bits = n; } static int size() { return NBITS; } bool at (int pos) const; // Returns (tests) the bit at bit position pos void set (int pos); // Sets the bit at position pos void set(); // Sets all bits void reset (int pos); // Resets (makes zero) the bit at position pos void reset(); // Resets all bits Eclass Bits { using IType = unsigned long long; enum { NBITS = sizeof(IType) * 8 }; IType bits = @; public: Bits() = default; Bits(IType n) { bits = n; MIMI static int size() { return NBITS; bool at(int pos) const { // Returns (tests) the bit at bit position pos if (bits & (1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
