Miscellaneous Notes =================== -- File names for C++ programs don't have to be the same as class names. My convention is to always use lowercase for file names and uppercase for class names. -- To compile on using g++, enter on one line all the .cpp files, e.g., g++ rat2.cpp rat2driver.cpp The default executable is called a.out To execute on linux, enter: ./a.out C++ FAQ --------- 1. Why can't operator<< and >> be member functions? 2. Do I have to write operator= and the copy constructor? 3. How is the const used in member functions? 1. You can never make operator<< and operator>> member functions because the left operand must be an object of the class and it never is. It's always an ostream or istream object, e.g., cout. 2. You always get a default overloaded assignment operator and copy constructor whether or not you write one. They will do a memberwise copy. If your class has dynamic memory, you will want to write your own operator= and copy constructor. 3. About const in member functions, for example, consider Rational operator+(const Rational &) const; The const for the parameter says constant Rational objects are allowed as parameters (in x+y, the right operand). Variable Rational objects are always allowed. The const at the end says constant Rational objects are allowed as current objects (in x+y, the left operand). Variable Rational objects are always allowed.