Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Program
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Parent {
// Inherited class
class Child extends {
// This method overrides show() of Parent
@Override void sho()
@Override void show()
{
System.out.println( Child's show());
}
Expand All @@ -18,14 +18,14 @@ class Main {
// If a Parent type reference refers
// to a Parent object, then Parent's
// show is called
Parent obj1 = new Parent()
Parent obj1 = new Parent();
obj1.show();

// If a Parent type reference refers
// to a Child object Child's show()
// is called. This is called RUN TIME
// POLYMORPHISM.
Parent obj2 = new Child()
Parent obj2 = new Child();
obj.show();
}
}