• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Has A relationship

 
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
we know that two classes have a Has a relationship if one class has a instance variable that refers to the other class...but if one class has an arraylist that contains the objects of the other class...then will be considered Has a relationship?
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Raju Champaklal wrote:we know that two classes have a Has a relationship if one class has a instance variable that refers to the other class...but if one class has an arraylist that contains the objects of the other class...then will be considered Has a relationship?





First of all you have a has- a relationship with ArrayList. When you will iterate over list and will assign those objects to instance variable of that type.
Your relationship with all the objects containing in that list is has-a relationship.

Please correct me...
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a hard situation. My ex-boyfriend cheated on me also. After 3 years, I thought about working these out with him, but it's so hard to trust after that trust has been broken. But I know in some cases it is possible, it just was not the case for me. The first thing you need to do is start trusting him again. This is going to be a process so the only thing you can do is to take things 1 day at a time. Good luck!
 
Ranch Hand
Posts: 257
Hibernate Oracle Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Raju,
That is definitely a has a relationship. Let us take an example.. A house might have many rooms (dining room, bed room, dressing room.. etc ). If you represent them in an object oriented way, it would be represented by has-a relationship. when we convert this relationship to a class level, we would create a class house which would have and arraylist of rooms..

I hope, this would clear your doubt..
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yup...thanks...but why is dating advice doing here
 
Salil Vverma
Ranch Hand
Posts: 257
Hibernate Oracle Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks like an example of lateral thinking but it went above my head..
Alice- could you please elaborate that a bit in context of has-a relationship.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic