I thought the compiler was supposed to give a warning about implicit conversion from int to double, but apparently, it doesn't even do that. No, you can't make the compiler give an error, either.
I think you should add a constructor that takes two ints.
Without an #if, #error is really useful when you want to play a prank.
More subtle ones include removing the f at the end of float literals. That forces the compiler to convert to double and back to float
Except when the compiler error comes out like this: "#error my error".
If you could get rid of the #error part of the message, it would be good.
I personally like the __LINE__ macro. I like to inform my users on what particular line in my source code they made an idiotic mistake.
It is just an exercise--if I can't, I can't. It just seems proper to me that I should be able write a rational number as a rational number in the code (and If I can't I should be able to prevent someone from making what I consider an easy mistake to make.)
The trys and catches in my code are just boilerplate--I only wrote this program so that I can periodically test the class I am trying to design.
I still have other problems with this code that I have not even tried to solve--like what to do if either the numerator or the denominator become to large (I believe that somewhere over 2 million you can no longer use integers.)
Sorry about not responding quicker, but wife insist that I attend a holiday celerbration.