java - IS-A and HAS-A relationship occur together in OOPS -


in java every class child of object. class is-a object. if contains data member of object type (actually type in case), has-a relationship. related above statement have following doubts. 1. there name relationship, is-a , has-a coming together? 2. there real world example it? 3. oops perspective, okay have relationship or should avoided?

  1. is there name relationship, is-a , has-a coming together?

no.

  1. are there real world example it?
list<set> alistthatcontainssets 

list , set both collections. in example list has bunch of sets.

  1. from oops perspective, okay have relationship or should avoided?

yes fine. can has-a yourself.

public class myclass{       myclass me;  } 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -