Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Handphone:
- def __init__(self, brand):
- self.brand = brand
- self.capacity = 100
- def get_brand(self):
- print(f"The brand is {self.brand}")
- def get_capacity_info(self):
- print(f"The capacity is {self.capacity}%")
- class Smartphone(Handphone):
- def __init__(self, brand):
- super().__init__(brand)
- self.capacity = 69
- self.network = "4G"
- def get_capacity_info(self):
- print(f"The capacity is {self.capacity}%")
- def get_network_info(self):
- print(f"The network speed right now is {self.network}")
- my_Nokia = Handphone(brand="Nokia")
- my_Nokia.get_brand()
- my_Nokia.get_capacity_info()
- my_Apple = Smartphone(brand="Apple")
- my_Apple.get_brand()
- my_Apple.get_capacity_info()
- my_Apple.get_network_info()
Advertisement
Add Comment
Please, Sign In to add comment