Guys, programming is 90% debugging, and 10% writing bugs, I have been debugging this code for nearly 3 hours. I have a question down below after the code.
Brief info about code:
I used default constructor, initialization constructor (doesn't work, but no bugs). I also integrated setters and getters including creating an object in main function to access the member functions of public class.
Why pass by reference when in all your other functions you pass by value?
Try to keep your code consistent.
void test1(other& use)
Prefer to pass by const reference when you aren't modifying the object in the function. Note that your getters need to be const functions.
double save_area = use.get_area();
but get_area() just returns the member variable area, which isn't initialised. You also don't calculate the area, which is why you get a garbage value.
The properties 'area' and 'volume' of class other are functions of properties length, width, and height, but allow the user to change them independently and without checking. This leads to logical inconsistencies.
If you want to let the user to change the area, then the set_area() has to update length, width, and volume too to keep the other consistent.
The other does not need member variables for area and volume; the computations are quite cheap. Without those members you don't have to keep them up to date.