Session 13 Object Oriented Programming (OOPS)
Session 13 Object Oriented Programming (OOPS)
Object Oriented
Programming
Session-13
simrantechmentor
What is OOP? Search . . .
simrantechmentor
Search . . .
Class
Object
Attribute
Behavior
simrantechmentor
Search . . .
What is Object ?
Attribute
Behavior
simrantechmentor
Search . . .
Attribute
Attribute represent quality, property or state of the object.
Variable → Attribute
name
course
fees
Attribute
Model Name
Model No
Mileage
Price
Honda Car
Color
simrantechmentor
Behavior Search . . .
attendClass
SubmitFees
takeExam
Behavior
browseCar
buyCar
sellCar
Honda Car
Service Car
simrantechmentor
Search . . .
What is Class ?
Class is a template or blueprint that defines attributes and behavior that is common to all
objects.
It provides reusability.
simrantechmentor
Example Search . . .
STUDENT Student
ROLLNO
NAME
DOB
GENDER
COURSE
FEES
CONTACTNO
takeAdmission
attendClass
takeExam
applyCertificate
simrantechmentor
Example Search . . .
CAR Car
ModelNo
ModelName
Mileage
Price
NoofWheels
AirBag
MusicSystem
buyCar
sellCar
serviceCar
STUDENT TEACHER
OFFICE STAFF
Search . . .
placeOrder()
Cancelorder()
trackOrder()
Object Example ( STORE)
Search . . .
PRODUCT
PRODUCTID
PRODUCTNAME
PRICE
DESCRIPTION
IMAGE
AVAILABLE
addProduct()
updatePrice()
deleteProduct()
updateAvailablity()
addToCart()
Object 1
Object 2
Product ID= P001
ProductName=“Arrow T-Shirt” Product ID= P002
Price=1500 Available=“No”
Description=“XYZ”
Image=“abc.jpg”
Available=“Yes”
addProduct() updateAvailablity()
Search . . .
Class Example (Online HOTEL BOOKING)
ROOM CUSTOMER Booking Payment
ROOMNO CUSTOMERID BookingID BillID
ROOMTYPE CUSTOMERNAME RoomID CustomerID
PRICE ADDRESS CUSTOMERID BillingDate
DESCRIPTION CONTACTNO CheckInDate BillAmount
Available CITY CheckOutDate PaymentMode
PaymentStatus
Booking-1
BookingID=“B001”
Booking RoomID = 2
CUSTOMERID= C001
BookingID
CheckInDate = 12/01/2023
RoomID
CheckOutDate =13/01/2023
CUSTOMERID
CheckInDate Reservation()
CheckOutDate
Booking-2
Reservation() BookingID=“B002”
cancelReservation() RoomID = [4,5,7]
CUSTOMERID= C003
CheckInDate = 11/01/2023
CheckOutDate =15/01/2023
Reservation()
Demonstration Class & Object Search . . .
Special Methods
__init__()
__str__()
simrantechmentor
Search . . .
simrantechmentor
Demonstration __init__() method Search . . .
simrantechmentor
Inheritance Search . . .
simrantechmentor
Inheritance Search . . .
Employee
EmployeeId
Name
Address
Experience
Contactno
Salary
addEmployee()
viewEmployee()
calculateSalary()
simrantechmentor
What is Inheritance? Search . . .
Inheritance allows us to define a class then inherits all the attributes and
method of existing class and adding its own attributes and methods.
Specialization refers to adding its own attributes and methods other than the
inherited method and attributes.
simrantechmentor
What is Inheritance? Search . . .
Class that has attributes and methods that will be shared by other classes.
simrantechmentor
Demonstration Inheritance Search . . .
simrantechmentor
Demonstration Inheritance Search . . .
simrantechmentor
Search . . .
THANK YOU
Kindly perform all in class exercise before coming to lab
END SLIDE
simrantechmentor
Contact No : 9878138788
Email : [email protected]