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?
- is there name relationship, is-a , has-a coming together?
no.
- are there real world example it?
list<set> alistthatcontainssets list , set both collections. in example list has bunch of sets.
- from oops perspective, okay have relationship or should avoided?
yes fine. can has-a yourself.
public class myclass{ myclass me; }
Comments
Post a Comment