daily pastebin goal
37%
SHARE
TWEET

[Rust] Implementing Drive trait in different car classes

cwchen Aug 28th, 2017 310 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. pub struct Toyota;
  2.  
  3. impl Drive for Toyota {
  4.     fn drive(&self) {
  5.         println!("Driving a Toyota car");
  6.     }
  7. }
  8.  
  9. pub struct Honda;
  10.  
  11. impl Drive for Honda {
  12.     fn drive(&self) {
  13.         println!("Driving a Honda car");
  14.     }
  15. }
  16.  
  17. pub struct Ford;
  18.  
  19. impl Drive for Ford {
  20.     fn drive(&self) {
  21.         println!("Driving a Ford car");
  22.     }
  23. }
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
 
Top