Last active
December 24, 2020 00:58
-
-
Save alecchendev/7c52806ddfd95411c1b399884931a3f3 to your computer and use it in GitHub Desktop.
OOP in rust article - dog struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Dog { | |
name: String, | |
} | |
impl Dog { | |
fn speak(&self) { | |
println!("Woof. My name is {}.", self.name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment