Python OOP (2) (1)
Python OOP (2) (1)
OOP nima?
class Dog:
pass
Instance Attributes
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
Class Attributes
# instance method
def description(self):
return "{} is {} years old".format(self.name,
self.age)
# instance method
def speak(self, sound):
return "{} says {}".format(self.name,
sound)
Python Object Inheritance