def __init__(self, world, homeID): self.id = Person.counter Person.counter += 1 self.world = world self.home = homeID self.infected = random.random( ) <= self.world.constants['infectionRate'] #Home(self) self.location = self.world.homes[self.home] self.sublocation = 0 self.smartphone = Smartphone(self) self.locationlog = []
from smartphone import Smartphone smartphone = Smartphone('Pocophone F1') smartphone.ligar() smartphone.conectar()
print(f'Falando... Estou em B') class C(A): def falar(self): print(f'Falando... Estou em C') class D(B, C): # Problema do diamante. D herda de duas classes com o mesmo método pass d = D() d.falar() print('\nExemplo real de herança múltipla') from smartphone import Smartphone s1 = Smartphone('Pocophone F1') s1.conectar() s1.desligar() s1.ligar() s1.conectar() s1.conectar() s1.conectar() s1.desligar() s1.conectar() s1.desconectar()
from smartphone import Smartphone smartphone = Smartphone('Pocofone F1') smartphone.conectar() smartphone.desligar() smartphone.ligar() smartphone.conectar() smartphone.conectar() smartphone.conectar() smartphone.desligar() smartphone.conectar() smartphone.desconectar()
from smartphone import Smartphone smart = Smartphone('Motorola One Fusion') smart.conectar() smart.desligar() smart.ligar() smart.ligar() smart.desconectar() smart.desligar()
from smartphone import Smartphone smartphone = Smartphone('iPhone') smartphone.conectar() smartphone.desligar() smartphone.ligar() smartphone.conectar() smartphone.conectar() smartphone.conectar() smartphone.desligar() smartphone.conectar() smartphone.desconectar() smartphone.desconectar()
from smartphone import Smartphone import os from adb_shell.adb_device import AdbDeviceTcp, AdbDeviceUsb from adb_shell.auth.sign_pythonrsa import PythonRSASigner if __name__ == '__main__': phone = Smartphone("Sony") print(phone.getName()) #os.system("cmd /c adb shell getevent /dev/input/event7")
from smartphone import Smartphone smartphone = Smartphone('Pocophone F1') smartphone.connect() smartphone.turn_off() smartphone.turn_on() smartphone.connect() smartphone.connect() smartphone.connect() smartphone.turn_off() smartphone.connect() smartphone.disconnect() smartphone.disconnect()
#aula sobre Herança Múltipla - o arquivo eletronico.py, smartphone.py e log.py estão associados a esta aula from smartphone import Smartphone smartphone = Smartphone('Exophone F1') smartphone.conectar() smartphone.desligar() smartphone.ligar() smartphone.conectar() smartphone.conectar() smartphone.conectar() smartphone.desligar() smartphone.conectar() smartphone.desconectar()
print(c1.nome) c1.falar() c1.comprar() a1 = Aluno('Maria', 20) print(a1.nome) a1.falar() a1.estudar() print(a1.__dict__) p1 = Pessoa('Gui', 34) p1.falar() c2 = ClienteVip('Deia', 30, 'Leite') c2.falar() # multipla herança from smartphone import Smartphone cel = Smartphone('Iphone') cel.conectar() cel.desligar() cel.ligar() cel.conectar() cel.conectar() cel.conectar() cel.desligar() cel.conectar() cel.desconectar() cel.desconectar()
from smartphone import Smartphone smartphone = Smartphone("Pocophone") smartphone.ligar() smartphone.conectar() smartphone.desconectar()