225 OOP - Chapter1
225 OOP - Chapter1
225 OOP - Chapter1
INTRODUCTION
OOP is like a solving a problem by creating objects is one of the most
popular approaches in programming. It aims to implement real-world
entities like inheritance, hiding, polymorphism, etc. and to bind together
the data and the functions that operates on them so that no other part
of the code can access by this data except that function.
OOP’s CONCEPTS
1. Class
2. Object
3. Method and Method Passing
4. Pillars of OOP’s
a. Abstraction
b. Encapsulation
c. Inheritance
d. Polymorphism
I. Compile-time polymorphism
II. Runtime polymorphism
DRY
DRY stands for Do not Repeat Yourself
- It focuses on code reusability.
01
CLASS
Class
It represents the set of properties or methods that are common to all objects of one
type. In general, class declarations can include these components, in order:
Attributes
Breed
Dog 1 Age Dog 3
Color
Behavior
Bark
Dog 2 Dog 4
Sleep
Eat
Instantiation
In Java, instantiation mean to call the constructor of a class that creates an instance
or object of the type of that class. It occupies the initial memory for the object and
returns a reference. It also provides the blueprint for the object