Kanti
asked on
I am trying to explain Extend & Interface through anological way . Does these sound Correct !
I am trying to define the Extending and Interface definitions in an analogical way . Let me know if this will be OK ?
Extending Analogical Example
Parental Property Inheritance | The concepts of Object Oriented
| Inheritance is also the same .
|
|
Inherited Parental Property means you | It means that you have all the data variables and
had inherited every thing what your | Methods of the parent class. This enables you have
parents had without much hard work! | More lines of code with the required logic without
| much hard work.
If you are renovating your parents property | class MyPropertyClass extends ParentPropertyClass
by adding a swimming pool and car park | {
besides that house all you do is spend |//You write the body of swimming Pool;
money to build only for these two things, | //You write the body of Car Park;
so you save money by not building a house.| // You need not write about the house as you are
So if you come from aKings family you | //extending your parents house;
could inherit all your Parents,Grand Parents | }
Etc. If you destroy the property you have |
nothing and in in JAVA it is called |
Method Over-ridding. |
Even JAVA there is no limit in the number of
extensions but remember each class can extend
only one super class at a time as JAVA does not
support Multiple inheritance
INTERFACE EXAMPLE
AIRPORT CHECK-IN | CLIENT CHECK-IN.
|
When you want to Fly out to another | Even in OO Technique the Bean
country you can board the Aircraft | Classes are not directly Exhibited to the
only when you show your passports which | Clients but uses an Interface
has your Signature, Expiry Date etc. | which has the method structure
This means that the CLERK identifies you | i.e method signatures of the Class
through the Passport as she sees Your | with no logic or you can say
image and Signature . | Interface has the skeleton of the Class.
| The Clients talk to the bean Class
| through the interface.
| So analogically if you want to compare
| with the Airport Check-in example the
CLERK LOOKS INTO PASSPORTs TO KNOW | Clerk will be your client ,The passport which
THE PASSENGER | identifies you will be the interface as it has
| your structure i.e your PHOTO and
| Signature and you will represent
CLIENT LOOKS INTO INTERFACE TO KNOW | the bean .So without
BEAN CLASS | Passport you are not allowed to
| board the Aircraft and with out
| INTERFACE the BEAN will not do anything
| for you .
NOTE:
There will no implementation in an
INTERFACE .So INTERFACE is like having the
PHOTO of the Class.
Extending Analogical Example
Parental Property Inheritance | The concepts of Object Oriented
| Inheritance is also the same .
|
|
Inherited Parental Property means you | It means that you have all the data variables and
had inherited every thing what your | Methods of the parent class. This enables you have
parents had without much hard work! | More lines of code with the required logic without
| much hard work.
If you are renovating your parents property | class MyPropertyClass extends ParentPropertyClass
by adding a swimming pool and car park | {
besides that house all you do is spend |//You write the body of swimming Pool;
money to build only for these two things, | //You write the body of Car Park;
so you save money by not building a house.| // You need not write about the house as you are
So if you come from aKings family you | //extending your parents house;
could inherit all your Parents,Grand Parents | }
Etc. If you destroy the property you have |
nothing and in in JAVA it is called |
Method Over-ridding. |
Even JAVA there is no limit in the number of
extensions but remember each class can extend
only one super class at a time as JAVA does not
support Multiple inheritance
INTERFACE EXAMPLE
AIRPORT CHECK-IN | CLIENT CHECK-IN.
|
When you want to Fly out to another | Even in OO Technique the Bean
country you can board the Aircraft | Classes are not directly Exhibited to the
only when you show your passports which | Clients but uses an Interface
has your Signature, Expiry Date etc. | which has the method structure
This means that the CLERK identifies you | i.e method signatures of the Class
through the Passport as she sees Your | with no logic or you can say
image and Signature . | Interface has the skeleton of the Class.
| The Clients talk to the bean Class
| through the interface.
| So analogically if you want to compare
| with the Airport Check-in example the
CLERK LOOKS INTO PASSPORTs TO KNOW | Clerk will be your client ,The passport which
THE PASSENGER | identifies you will be the interface as it has
| your structure i.e your PHOTO and
| Signature and you will represent
CLIENT LOOKS INTO INTERFACE TO KNOW | the bean .So without
BEAN CLASS | Passport you are not allowed to
| board the Aircraft and with out
| INTERFACE the BEAN will not do anything
| for you .
NOTE:
There will no implementation in an
INTERFACE .So INTERFACE is like having the
PHOTO of the Class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In a hospital: everybody in a long white coat and a stethoscope is taken for a doctor: INTERFACE, the patients sight.
In fact it takes many years to study and to promote to be a surgeon: EXTEND, the administration's sight.
I am a hired programmer and sit beside the customers employees.
I'm an INTERFACE (to the team) they are only intereseted in my skill.
The person right to me is a CLASS: he/she is an employee and will be promoted on success (EXTENSION).
From sheer frustration, ;JOOP!