Question: write a programm in C++ QUESTION 1 The class and the program are in one.cpp file. Define the OddNumber class for representing an odd number.
QUESTION 1 The class and the program are in one.cpp file. Define the OddNumber class for representing an odd number. The class contains: - A data frold value of the int type that represents the integer value stored in the object. - A default constructor that creates an OddNumber object for the value 1. - A constructor that constructs an OddNumber object with the specified (passed) value. - A function named getValue() to return an int value for this object - A function named getNext() to return an OddNumber object that represents the next odd number after the current odd number in this object. - A function named gotPrevious() to return an OddNumber object that represents the previous odd number before the current odd number in this object Implement the class. Write a test program that creates an OddNumber object for value 9 and invokes the getNext() and got Previous() functions to obtain and display these numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
