Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. Introducing Classes: The Fra... > Example 11.4. Fraction Arithmetic: a...

Example 11.4. Fraction Arithmetic: add and mult

The next step in creating a Fraction class is to add some arithmetic functions, add and mult. In Chapter 13, we’ll create operator functions that call these arithmetic functions.

Addition is the hardest, but you may recall the technique from grade school. Consider addition of two fractions:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint