IS-A HAS-A Relationship
IS-A refers to inheritance or implementation.
IS-A is expressed with the keyword extends.
HAS-A means an instance of a class, member variable that can be accessed by an object can be expressed as has a relationship.
Example:
[java]
class Car extends Vehicle
{
String door;
}
[/java]
Correct answer
- Car is a vehicle
- Vehicle has an engine
- Car has an engine
- Car has a door
wrong answer
- Vehicle is a Car
- Vechile has a door
- Vehicle has a Car