Unit 9 - Inheritance
// Hack 1
class Person {
int heartbeats;
String bloodtype;
String eyecolor;
public Car(int heartbeats, String bloodtype, String eyecolor) {
this.heartbeats = heartbeats;
this.bloodtype = bloodtype;
this.eyecolor = eyecolor;
}
public void speak (){
System.out.print("Hi my name is gerald");
}
}
class dog extends Person {
String tail;
public dog(int heartbeats, String bloodtype, String eyecolor, String tail){
super(heartbeats,bloodtype,eyecolor,tail);
this.tail = tail;
}
//Hack 2
@Override
public void speak(){
System.out.println("woof");
}
}
class Test {
public static void main(String[] args)
{
dog s = new dog();
}
}