what casing is used for Class
Camel casing vs snake casing which is used for variable
how to create an instance and attribute
“init” method
self keyword can be something else, but just stick with self. it means it is associated with the specific instance
class Dog():
def \_\_init\_\_(self,breed):
self.breed = breadmy_dog = Dog(breed=’Husky’)
two major features of a Class
attribute and methods
class object attributes
class Dog():
species = 'mammal'what is method
method is a function inside a class work in the object in some ways
how to create a method
class Dog():
def bark(self,variable1, variable2):
print(self.name)inheritence
class Dog(BaseClass):
passpolymorphism
different class using the same method name
magic/Dunder methods
or how to print an instance
create special methods so that the class can be defined for build-in functions
e.g. string representation
def \_\_str\_\_(self):
return f'My name is {self.name}'e.g. len representation
def \_\_len\_\_(self):
return self.radius