#include class Fraction { public: void SetNumerator(int n); void SetDenominator(int d); double ToDecimal(); private: int numer; int denom; }; void Fraction::SetNumerator(int n) { numer = n; /* notice we are accessing private member numer here. */ } void Fraction::SetDenominator(int d) { if(d != 0) denom = d; else denom = 1; } double Fraction::ToDecimal() { return (double) numer / denom; /* integer division */ } int main() { Fraction F; /* F.numer = 1; */ F.SetNumerator(1); F.SetDenominator(2); std::cout<<"Decimal: "<