When you have an 'is-a' relationship, it has to do with inheritance and the classes which inherit. The sub class acts like a parent class. For instance, an onion is a vegetable. So you would code in a way that states the class is the onion that extends the vegetable. When you're dealing with 'has-a' relationships, it is more about composition which produces instances of references to other objects. For example, a swimming pool has a hot tub. In OOP, you'd create a class pool and within it an instance of a hot tub.
Posted Date:- 2021-09-30 00:38:45