reset password
Author Message
Bsobpi
Posts: 9
Posted 17:14 Apr 07, 2017 |

Hi, Im having trouble trying to figure out how the (MyFraction o) parameters work

I implemented the methods from MyMath into MyFraction and after writing the calculation in add(MyFraction o), for example, I wanted to call the method but not sure how to call one that uses interface as a parameter. If it was a int for parameters I would write it as add(5); but for this assignment I can't figure out what would go into the parenthesis when calling.

jhurley
Posts: 207
Posted 17:29 Apr 07, 2017 |

MyFraction should implement the interface parameterized by MyFraction.  CSNS can't render the angle-brace syntax correctly because it looks like an html tag, but see the lecture examples of comparables.  If you have that correct, you can write the methods so that the parameters are of type MyFraction.