Question: Background In Object - Oriented languages it can be useful to share code between groups of related classes. We do this via inheritance. Both cats

Background
In Object-Oriented languages it can be useful to share code between groups of related classes. We do this via inheritance.
Both cats and dogs have names and ages, so we may wish to share this functionality in a super class.
When we do not know the default functionality we want subclasses to have, we use an abstract method. An abstract method must be implemented by its subclasses. If a class has any abstract methods, it must be declared as an abstract class.
abstract class A {
public abstract int f();
}
class B extends A {
@Override
public int f(){
// Implementation
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!