scientific_comp_projects/CODE/[python]object_oriented(tec.../animals.py

19 lines
253 B
Python

class Dog:
def __init__(self,name):
self.name = name
print(name)
def add_one(self,x):
return x+1
def bark(self):
print("bark")
d = Dog('Tim')
d2 = Dog('Billy')
d.bark()
print(d.add_one(5))
print(type(d))