added blog and improved docs
This commit is contained in:
@@ -71,6 +71,10 @@ pub class Animal {
|
||||
pub fn speak(*self) {
|
||||
println!("Unknown");
|
||||
}
|
||||
|
||||
pub fn legs(*self) {
|
||||
println!("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
pub class Dog : Animal {
|
||||
@@ -81,6 +85,11 @@ pub class Dog : Animal {
|
||||
pub override fn speak(*self) {
|
||||
println!("Woof!");
|
||||
}
|
||||
|
||||
// Explicit override is useful for super inheritance
|
||||
pub override(Animal) fn legs(*self) {
|
||||
println!("4 legs");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user