#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); // the following is only spread over three lines to improve clarity fraction * paf = & a; int * pai = (int *) paf; * pai += 1; /* one line equiv: * (int *) & a += 1; */ a.print(cout); }