Vous êtes sur la page 1sur 12

INHERITANCE(GENERALIZATION):

Extracting common features of all


the classes
Into a base class & inheriting original
classes
From this new class
For instance, the common attributes of patient,
doctor and hospital staff are extracted into
person class.

ABSTRACTION:
Capturing only those details about an
object

That are relevant to current


perspective.
In the preceding example a person can has his
height, complexion,eye color as an attribute but
this is irrelevant for a patient and a doctor being
an object.
PERSON
+name
-age
-gender
-adress
+registration()

PATIENT
-medical history
-ongoing treatment
+gets admitted()
+undergoes treatment()
+gets discharged()

DOCTOR
-working id
-designation
-specialization
-visiting timings
-salary
+checks the patient()
+prescribes the patient()

OVER-RIDING:
Extending, limiting or improving
the default
Behavior of the base class

In the given class of hospital staff, the


administrative duties are limited only to the admin
staff & the assistance duties are limited only to the
medical staff.

SUB-TYPING:
Says that The derived class is
behaviorally in compatible with
The base class & can replace it

In the given example the outdoor treatment


class & the admission +treatment class have
nearly the same attributes as that of the base
class.

SPECIALIZATION:
Says that
the derived class is behaviorally
incompatible
With the base class & cant replace
it.

In the preceding example, the patient class has a


unique feature i.e. its medical history & ongoing
treatment. Thats why it cant replace the person
class. Similarly, the doctors class has its own
attributes, making it incompatible with the person
class.

ONE-WAY ASSOCIATION:
Its a relationship between two objects of different
classes in which one objects serves the other. As in
the given example doctors serves the patients by
providing treatment.

TWO-WAY ASSOCIATION:
Its a type of association in which both objects
serve each other. For instance, doctor treats the
patient and the patient in turn pays the doctor.

AGRREGATION:
The relationship between the container & the
contained object is called aggregation. Its a weaker
relationship because the aggregated components
can exist independently. In the given example the

equipment class and the ward/room class is


aggregated into the admission class.

POLYMORPHISM:
a function having the same
name but different
functionalities is said to be showing
polymorphism.
For instance, the function having the name
registration in the person class performs different
function in context of derived classes. In patient
class it takes the input as the entry

date,time,treatment etc.while in doctors class it is


concerned with doc designation, his id etc.

Vous aimerez peut-être aussi