Friday 22 July 2011

real life difference between interface and abstract classes .

look java is real life language . and the creator create this language for this real life so , every thing is implemented in a practical way means it should implements in your real life .

so i want to explain something , i know that if you are a learner than you know these things but do you
know the real life implementation of these things . i think here you are after me . now i want to explain these basic things , because basics can fuck any engineer .

interface generally provides you a thing that , abstract can not provide you .
------------------------------------------------------------------------------------------------------------------

you all read the defination of abstract that collect these things in a common place . but you implement these things in your life .
i need these things that please implement every thing in your life .
now think you have a organization . and in organization every one is employer . so you gather all common thing in employer .
but can you differentiate employers . from only abstract thing . i think no .
take a example . that you have no information in abstract  . and you say he is manager ,and he is ceo .

remember that in abstract you put your common things .

and by multiple inheritance we can not extend two classes .

------------------------------------------------------------------------------------------------------

now in interface , you read that this is contract . ya its ok but how to implement it . think that you have 3 persons and you have to differentiate them , for this you just take a interface and define what you want ,
take a example . a person is different from this person because he wear hat , bands , jeans .. so provide these things into some interface  ...

thats why we say that a class extend more than one interface

so a interface is used in real life for differentiating a thing from another .
------------------------------------------------------------------------------------------------------

No comments: