# Topic covered
* Classes, Objects
* Inheritance, Polymorphism

It’s important to know how each of the paradigms work and how they urge you to structure the code within them, but with respect to architecture, Object-Oriented Programming is the clear tool for the job.

Not only does Object-Oriented programming enable us to create a plugin architecture and build flexibility into our projects; OOP comes with the 4 principles of OOP (encapsulation, inheritance, polymorphism, and abstraction) that help us create rich domain models.

SNC: Python OOPs

3.1 Classes and Objects

  • Noun –> Classes (Objects)
  • Verb –> Behaviour

Classes

2 kind of relationships among classes

  • has a relation
    • Composition
      • Customer has-a Credit card
      • No existence of card without customer
    • Aggregation
      • Cart has-a Product
      • Product can exist without cart
  • is a relation
    • It an inheritance relation
    • ParkingLesson is a CarLesson
    • DrivingLesson is a CarLesson

Inheritance and Polymorphism