python model class example
Example 1: python class
class Dog(object):
def __init__(self, name, age):
self.name = name
self.age = age
def speak(self):
print("Hi I'm ", self.name, 'and I am', self.age, 'Years Old')
JUB0T = Dog('JUB0T', 55)
Friend = Dog('Doge', 10)
JUB0T.speak()
Friend.speak()
Example 2: oop in python
class Object:
#__init__() is called when you create an Object class
def __init__(self,arg):
#stores argument in self
self.arg = arg
def printArg(self):
#calls argument from self
print(self.arg)