Quiz · Generics and traits · lesson 4 of 8
Quiz — a default method
What does the program print?
trait Greet {
fn hi(&self) -> String {
String::from("hello")
}
}
struct En;
impl Greet for En {}
fn main() {
println!("[{}]", En.hi());
}