Question: 7. Define a class named PrimeNumber that stores a prime number. The default con- structor should set the prime number to 1. Add another constructor
7. Define a class named PrimeNumber that stores a prime number. The default con- structor should set the prime number to 1. Add another constructor that allows the caller to set the prime number. Also, add a function to get the prime num ber. Finally, overload the prefix and postfix++ and -- operators so they PrimeNumber object that is the next largest prime number (for++) and the next smallest prime number (for --). For example, if the object's prime number is set to 13, then invoking ++ should return a PrimeNumber object whose prime number is set to 17. Create an appropriate test program for the class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
