package com.rex.oop;

abstract class Animal {
	String name;
	
	abstract String bark();
}

class Dog extends Animal{

	@Override
	String bark() {
		return "Ruff";
	}
	
}

class Cat extends Animal {

	@Override
	String bark() {
		return "Meow";
	}
}

public class InheritanceExamples {
	public static void main (String[] args) {
		Dog dog = new Dog();
		dog.name = "Fido";
		
		Cat cat = new Cat();
		cat.name = "Garfield";
		
		// polymorphism
		Animal animal = new Cat();
		System.out.println(animal.bark());
		animal = new Dog();
		System.out.println(animal.bark());
	}
}

@@ -72,20 +72,21 @@
  String 
-bark
+noise
 ();%0A%7D%0A%0Ac
@@ -122,36 +122,41 @@
 verride%0A%09String 
-bark
+makeNoise
 () %7B%0A%09%09return %22R
@@ -216,20 +216,25 @@
 %09String 
-bark
+makeNoise
 () %7B%0A%09%09r
@@ -500,28 +500,33 @@
 ntln(animal.
-bark
+makeNoise
 ());%0A%09%09anima
@@ -572,12 +572,17 @@
 mal.
-bark
+makeNoise
 ());

Update InheritanceExamples.java