It depends on how you will be using those functions. Since both belong to the same class, you can make num
and denom
(private) members of the class. But you can also use references if those values come from outside the class. This will work regardless of the functions belonging to the same class or not:
class fraction
{
public:
void init(int& num, int& denom) const;
void otherFunction(int num, int denom);
}
void fraction::init(int& num, int& denom) const
{
cout<<"enter the values for the numerator and denominator\n";
cin>>num;
cin>>denom;
}
// Define otherFunction() appropriately
Then use those functions in another piece of code:
// ...
int aNum, aDenom;
fraction fr;
fr.init(aNum, aDenom);
fr.otherFunction(aNum, aDenom);
// ...