QWhat do we say when a class B can extend another class A?
Question Info
Choose the Best Option
Click any option to instantly check if you're correct.
Explanation
In object-oriented programming, a subclass is a class that is derived from another class, called the superclass. The subclass inherits properties and methods from the superclass and can also have additional properties and methods of its own.
The subclass is also called an extension of the superclass, because it extends the functionality of the superclass with additional features.
For example, consider the following class hierarchy:
class A {
// Properties and methods of class A
}
class B extends A {
// Properties and methods of class B
}
Here, A is the superclass and B is the subclass. B is derived from A and inherits all of the properties and methods of A. B can also have additional properties and methods of its own.
In this example, A is the superclass and B is the subclass. In the scenario you described, A would also be the superclass and B would be the subclass.
Share This Question
Challenge a friend or share with your study group.