#include using namespace std; class fraction { protected: int top, bot; public: fraction(int t, int b) { top = t; bot = b; } void print(ostream & out) { out << top << "/" << bot << "\n"; } fraction mul(fraction other) { return fraction(top * other.top, bot * other.bot); } }; int main() { fraction a(1, 4), b(3, 7); a.print(cout); a.top += 1; a.print(cout); }