_
_
_umr2017-02-06 20:39:30
Java
_umr, 2017-02-06 20:39:30

How to understand part of the text from the book about HAS-A and IS-A?

For example, they write:
If you want to know if one entity extends another, check for compliance with IS-A.
The triangle is a shape.
A cat is a member of the cat family.
This will all be true until you check for compliance.
I didn't understand here.
And then they write:
These concepts are interconnected, but through inheritance. Such a relationship is expressed by the ratio HAS-A. Isn't it logical to say that the bathroom contains a bathtub? In other words, the bathroom class contains a reference to the Tub class but does not extend it.
As I understand it, IS-A is when the parent class is extended through extends to the child.
And HAS-A is when a reference to the Tub object is created inside the Bathroom class through new Tab ().
I'm right? But in the book just below, they write:
The bathroom (bathroom) contains a bath (Tub). But none of them inherits (extends) the other.
WHAT???

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question