Create a class that imitates part of the functionality of the basic data type int. Call the class Int (note different capitalization). The only data in this class is an int variable. Include member function to initialize an Int to 0. Write proper getter & setter functions to initialize it to an int value and to return this when needed. Also write a function to display it (it looks just like an int) and to add two Int values. Write a main program that exercises this class by creating one uninitialized and two initialized Int values, adding the two initialized values and placing the response in the uninitialized value, and then displaying this result. Save the file as Int.cpp.
(Using CPP) Create a class that imitates part of the functionality of the basic data type int. Call the class Int (note different capitalization). The only data in this class is an int variable. Include member function to initialize an Int to 0. Write proper getter & setter functions to initialize it to an int value and to return this when needed. Also write a function to display it (it looks just like an int) and to add two Int values. Write a main program that exercises this class by creating one uninitialized and two initialized Int values, adding the two initialized values and placing the response in the uninitialized value, and then displaying this result. Save the file as Int.cpp.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images