@ in python class code example
Example 1: create and use python classes
class Mammal:
def __init__(self, name):
self.name = name
def walk(self):
print(self.name + " is going for a walk")
class Dog(Mammal):
def bark(self):
print("bark!")
class Cat(Mammal):
def meow(self):
print("meow!")
dog1 = Dog("Spot")
dog1.walk()
dog1.bark()
cat1 = Cat("Juniper")
cat1.walk()
cat1.meow()
Example 2: classes in python
class Foo:
def __init__(self):
self.definition = Foo!
def hi():
Example 3: how to use class's in python
class person:
name = "jake"
age = 13
x = vars(person)
print(x)