Advertisement
cwchen

[Rust] Calling Rational class

Sep 4th, 2017
3,145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.25 KB | None | 0 0
  1. fn main() {
  2.      let a = Rational::new(-1, 4);
  3.      let b = Rational::new(1, 5);
  4.  
  5.      // Call operator-overloaded binary '+' operator
  6.      let y = a + b;
  7.  
  8.      // Call operator-overloaded formated string
  9.      println!("{} + {} = {}", a, b, y);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement