Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
29
Task/Abstract-type/Vala/abstract-type.vala
Normal file
29
Task/Abstract-type/Vala/abstract-type.vala
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
public abstract class Animal : Object {
|
||||
public void eat() {
|
||||
print("Chomp! Chomp!\n");
|
||||
}
|
||||
|
||||
public abstract void talk();
|
||||
}
|
||||
|
||||
public class Mouse : Animal {
|
||||
public override void talk() {
|
||||
print("Squeak! Squeak!\n");
|
||||
}
|
||||
}
|
||||
|
||||
public class Dog : Animal {
|
||||
public override void talk() {
|
||||
print("Woof! Woof!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
Dog mike = new Dog();
|
||||
Mouse scott = new Mouse();
|
||||
|
||||
mike.talk();
|
||||
mike.eat();
|
||||
scott.talk();
|
||||
scott.eat();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue