Objects Implement Roles
A convenient way to illustrate the difference between class inheritance and interface inheritance is to consider roles object may take on. The role of "The Terminator" may be described via:
interface Terminator {
public void doRandomViolence();
}
This role may be "played" by any number of objects such as:
class Arnold extends Actor implements Terminator {
public void doRandomViolence() {...}
...
}
and
class Dilbert extends Geek implements Terminator {
public void doRandomViolence() {...}
...
}
Arnold and Dilbert have totally different identities (Actor versus Geek,
respectively), but both may play the role of "The Terminator."
A single object may play multiple roles; e.g., Dilbert is also able to play the role
of an engineer (it is not true that all geeks are engineers so we cannot rely on class
Geek having the necessary engineer interface):
class Dilbert extends Geek
implements Terminator, Engineer {
public void doRandomViolence() {...}
public void borePeople() {...}
}
where Engineer is defined as:
interface Engineer {
public void borePeople();
}
I was reading the java tutorial and found out this!!
do we really bore ppl and all the engineers are geeks!!!...:O..:P
check the picture.
Code wins argument
3 years ago
8 comments:
all the engineers are not geeks ...
but it proves that all the engineers bore people .. f**k man !! what u mean !! na na its not fair .. its not true... ... the definition should be like this :
interface Engineer {
public void doNotBorePeople();
public void smartAndIntelligent();
Fun funLoving = new Fun();
Vector vc = funLoving.getGroups();
String funny = "";
for(int i = 0; i< vc.size(); i++){
funny = (String) vc.elementAt(i);
System.out.println("Engineers always love fun in the mentioned groups: "+funny);
}
:D :D :D :D :D
hudai fapor nilam .. never mind :P (all copy paste program)
hahahaha... dipu, im sure anybody who came to knw us(the grp) will say we r not geeks, not boring, and funloving fokra polapan.:P
I totally agree, you guys are some boring geeks!! :-P
hay hay... eki holo!!.. :P
:O
:-S
:P
shit man !!
ahare khaleda ki lau bibiya..:P
I will be flattered if someone calls me a "Geek".
If someone calls me Boring, i'd be really happy, but i probably won't talk to him/her anymore....
See. Fun is like an old fashio. Everyone wants to be fun...it's really outdated....
Heehee...Proudly, I'm the most Boring guy on earth...
geeks rules..:D
Post a Comment