However, is there any determination of IS-A or HAS-A relationship when using Abstract Classes?
Q's:
- Does RoboDog 'Have-A' barkLoudness of 5?
- Does RoboDog 'Have-A' or 'IS-A' bark() ?
- What about Interface methods and static variables if RoboDog were to implement them? Would they be considered 'HAS-A' or 'IS-A'?
Links to articles would also be helpful please.
Thanks in advance,
Ehsan
SCJP 1.5, SCJD 1.6
Vikas Kapoor
Ranch Hand
Joined: Aug 16, 2007
Posts: 1374
posted
0
Does RoboDog 'Have-A' barkLoudness of 5?
- Does RoboDog 'Have-A' or 'IS-A' bark() ?
Ehsan, you are misinterpreting the IS A and HAS A relationship. They are not comparable with state and behaviour of Class.
Please have look at IS-A and HAS-A.
Here Dog extends Animal and Dog is an instance of Animal. This is IS-A relationship.
Here Dog has an instance of Collar class. This is HAS-A relationship.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Determining IS-A & HAS-A Relationship when using Abstract Classes / Interfaces