Question: 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 

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

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 Computer Network Questions!