Skip to content

Instantly share code, notes, and snippets.

@alecchendev
Last active December 24, 2020 00:58
Show Gist options
  • Save alecchendev/7c52806ddfd95411c1b399884931a3f3 to your computer and use it in GitHub Desktop.
Save alecchendev/7c52806ddfd95411c1b399884931a3f3 to your computer and use it in GitHub Desktop.
OOP in rust article - dog struct
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