Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Trait for binary '+' operator
- use std::ops::Add;
- // Trait for formatted string
- use std::fmt;
- // Automatically implement Copy and Clone trait
- // Therefore, our class acts as a primitive type
- #[derive(Copy, Clone)]
- pub struct Rational {
- num: i32,
- denom: i32,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement