2. • OOP (Object-oriented Programming) is a programming
paradigm used to design programs by dividing them into
objects. Each object represents a real-world entity,
containing data (attributes) and behaviours (methods).
• Advantages of OOP:
- Organized.
- Reusability.
- Readability.
- Performance.
3. • Objectives of OOP:
- Simplify code reuse.
- Reduce complexity by dividing programs into smaller units.
- Improve program maintenance and scalability.
• Java is a class-basd ,OOP language.
• Pyhton , C++ , visual Basic.NET also support OOP.
4. • Core Principles of OOP:
- Encapsulation: Hiding implementation details and protecting
data.
- Inheritance: Reusing code by allowing one class to inherit the
properties of another.
- Polymorphism: Using the same interface to perform different
operations.
- Abstraction: Showing only essential features while hiding
unnecessary details.
5. • A class is a blueprint or template used to create objects. It
contains attributes that represent data and methods that
represent behaviours.
• Example of a Class:
class Car {
String name; // Attribute
int speed; // Attribute
void start() { // Method
System.out.println("Car is starting...");
}
}
6. • A class itself is not an object but serves as a template for
creating objects.
• A class can include variables, methods, and even other nested
classes.
• Data can be described as property ,description ,feature ,quality
,trait ,attribute or characteristic.
• Method can be described as function , behaviour or operation.
7. • An object is an instance of a class created using the new
keyword. It represents an independent unit containing
attributes and methods that operate on them.
• Objects are the things you think about first in designing.
• How to Create an Object:
Car myCar = new Car(); // myCar is an object of the Car class
8. • Object Properties:
- Each object is allocated separate memory space.
- Different objects of the same class can have different attribute
values.
• The different between objects which are instance from same
class is data value.
• The different between class and object appear at run time.
• Object is NULL by default.
9. OOP & POP
OOP(Object-Oriented Programming)
POP(Procedure Oriented Programming)
Features
This type of programming language uses
objects and classes for creating models.
This programming language uses a step-by-step
approach for breaking down a task into a collection of
routines and variables by following a sequence of
instructions.
Definition
Parts known as objects.
Smaller parts called function.
Divided in to
Is given to data.
Is given to function.
importance
Bottom Up approach.
Top Down approach.
approach
Have access specifiers.
Don’t have any access specifiers.
Access Specifiers
Provide data hiding so it’s more secure.
Doesn’t have any proper way for hiding data so it’s less
secure.
Data Hiding
Is possible.
Is not possible.
Overloading
Organized around classes and objects.
Organized around functions and procedures.
Code
Organization
Supports inheritance .
Does not support.
Inheritance
C++, JAVA ,VB.NET, C#.NET
C, VB, Pascal
Examples