Perbedaan antara objek dan kelas dalam python

# In Object Oriented Programming (OOP):
# An object is an instance of a class.
# A class is a blueprint/template for an object.

# A class is a collection of 
#     - attributes (data/variables) and 
#     - methods (functions) 
# which fulfill a specific function.

# Example: 

class Car():
    def __init__(self, brand, model, colour, owner):
        self.brand = brand
        self.model = model
        self.colour = colour
        self.owner = owner
            
    def honk(self):
        print(f"I am {self.owner}'s {self.colour} {self.brand} {self.model}!")
        
bob_car = Car('Volvo', 'Sedan', 'black', 'Bob') 
amy_car = Car('Mini', 'Cooper', 'red', 'Amy')

bob_car.honk()
amy_car.honk()

# >>> I am Bob's black Volvo Sedan!
# >>> I am Amy's red Mini Cooper!

# Car is the blueprint for the objects bob_car and amy_car.
# bob_car and amy_car objects were instantiated from the class Car.
Undercover Cat