Class
is a blueprint for creating individual objects that contain the general characteristics of an object.
class ClassName:
# fields, constructor
public_member # This can be accessed from outside the class
# This cannot be accessed from outside the class, shown with two underscores
__private_member
Notes:
>>> class Bike(object):
... def __init__(self, gear, speed):
... self.gear = gear
... self.speed = speed
...
... def apply_brake(decrement):
... self.speed -= decrement
...
... def speed_up(increment):
... self.speed += increment
...
ss