mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-03 02:40:40 +00:00
25 lines
293 B
Rust
25 lines
293 B
Rust
//! Checks basic default method functionality.
|
|
|
|
//@ run-pass
|
|
|
|
trait Foo {
|
|
fn f(&self) {
|
|
println!("Hello!");
|
|
self.g();
|
|
}
|
|
fn g(&self);
|
|
}
|
|
|
|
struct A;
|
|
|
|
impl Foo for A {
|
|
fn g(&self) {
|
|
println!("Goodbye!");
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
let a = A;
|
|
a.f();
|
|
}
|