Question: please use c++ 1. Please create a class TheaterSeat, which has two member variables and one static variable: private: int * VIPSeat; int *regularSeat; static

please use c++

1. Please create a class TheaterSeat, which has two member variables and one static variable: private: int * VIPSeat; int *regularSeat; static int swapCount; //This static variable will tally the total number of swaps made by all TheaterSeat instances. It's probably a nonsensical variable, I just wanted to dump it in for you to practice 'static.'

2. Please create a function called swap(), apart from other necessary member functions (getters, setters, constructor, etc). Inside the swap() function, you will need to swap the values (memory addresses) of the pointers variables VIPSeat and regularSeat. (Note: not to swap the de-referenced values, but the reference values - memory addresses). You may increment the static variable swapTotal value inside the swap() function. public: void swap();

3. In your main() function, please create at least two instances of TheaterSeat class. For two instances, you need to create four local variables, say int seat1, int seat2, int seat3, and int seat4. Assign some (unique) numbers to each of seats. Associate two of the seat numbers to instance 1's VIP seat and regular seat; the other two for instance 2. Then swap the VIP seat and the regular Seat using swap() member function for each of the instances. Lastly, display the VIP seat number and the regular seat number for instance 1 and instance 2, as well as the total swap count (display the value of the static variable swapCount).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!