daily pastebin goal

[Rust] Using Drive trait

cwchen Aug 28th, 2017 427 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     let mut cars = Vec::new() as Vec<Box<Drive>>;
  3.     cars.push(Box::new(Toyota));
  4.     cars.push(Box::new(Honda));
  5.     cars.push(Box::new(Ford));
  6.     for c in &cars {
  7.         c.drive();
  8.     }
  9. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand