I have a class ("Class A", we'll call it) which calculates the value of a private variable (which we can call numLoaves) with a public function. I need to use the value of numLoaves in a public function in Class B.
What is the best and most efficient way to pass in this value? I'm new to programming and have been looking for a solution for hours with no luck. Note: The function in Class B is void and must be this way. I can't use global variables or objects, pointers, friend functions or friend classes. The variable must be private.