OBJECT CLASS in Object Oriented
Programming
OBJECT
An object represents a
particular instance of a class.
They
are instance of classes.It is a basic unit of a system. An object is an entity
that has attributes,behavior, and identity. Attributes and behavior of an
object are defined by the class definition.
It’s a basic unit of a
system. An object is an entity that has attributes, behavior, andidentity.
Objects are members of a class. Attributes and behavior of an object are
definedby the class definition.
Objects should
have its own property and behavior. For example, Customer in Banking system
may have first name, last name, address and based on activity and
account balance you can consider it as Regular customer or
Premium Customer,
etc.
CLASS
A class
describes all the attributes of objects, as well as the methods that implement
the behaviorof member objects. It is a comprehensive data type, which
represents a blue print of objects. It is the blueprint/ plan/
template of an object
Classes are data types
based on which objects are created Objects with similar properties and methods
are grouped together to form a Class. Thus a Class represents a set of
individual objects. Characteristics of an object are represented in a class as
Properties. The actions that can be performed by objects become functions of
the class and is referred to as Methods.
What is difference between Association,
Aggregation, and Inheritance relationships?
Association
This is the
simplest relationship between objects. Example every customer has sales.
SoCustomer object and sales object have an association relation between them.
Class A uses Class B.
It's has a relation
- Employee uses
BusService for transportation.
- Client-Server
model.
- Computer uses
keyboard as input device.
An association
is used when one object wants another object to perform a service for it.
In simple words:
I have a Watch. There is a relationship between Me and my watch but we are not
dependent on each other. I can exist without my watch and my watch can exist
without me so this is called Association.
Life or existence of the associated objects are
independent of each other, they just provide some kind of service to each
other.
No comments
Post a Comment