Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ class, AllKinds, that has three member variables of type int, long, and float. The class must have a default constructor that
Write a C++ class, AllKinds, that has three member variables of type int, long, and float. The class must have a default constructor that initializes every variable to -1, have another constructor that takes in each variable type to initialize (three arguments), and have "getters" and "setters" for each type. (Example: get Int (), set Int () ...) Have public functions long intPlusLong (); float intPlus Float (); float longMinus Float (); that take the sum or difference of the internal variables as implied by function name. Write a simple main() function to declare two instances of this class, one using the default constructor and one using the initialization constructor. For the class constructed with the default constructor, set each internal member variable of that class to a new number. Then call each arithmetic operator on both classes and print out the result. Select test values to demonstrate that your class is fully operational.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started