コード例 #1
0
ファイル: main.py プロジェクト: Castagnna/OOP-python
# Getter and Setters
from product import Product

p1 = Product('t-shirt', 100)
p1.discount(20)
print(p1.name, p1.price)

p2 = Product('cup', 'RS15')
p2.discount(10)
print(p2.name, p2.price)
コード例 #2
0
person.eat('banana')
person.stop_eating()
person.stop_eating()
person.eat('orange')

person.speak('technology')
person.stop_eating()
person.speak('technology')
person.speak('gym')
person.stop_speaking()
person.stop_speaking()
person.speak('financial')
person.get_birthday_year()

print(Person.current_year)

new_person = Person.build_person_by_birthday_year('Jose', 1999)
print(new_person.age)
new_person.get_birthday_year()

Person.create_id()
person.create_id()

t_shirt = Product('T-SHIRT', 50)
t_shirt.discount(10)
print('New price of:', t_shirt.name, t_shirt.price)

shoe = Product('SHOE', 'R$40')
shoe.discount(10)
print('New price of:', shoe.name, shoe.price)