-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuper.py
29 lines (22 loc) · 744 Bytes
/
super.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 14:18:03 2020
@author: saura
"""
class User():
def __init__(self, email):
self.email = email
def signed_in(self):
print("User is logged in.")
def attack(self):
print("Do nothing.")
class Wizard(User):
def __init__(self, name, power, email):
self.name = name
self.power = power
super().__init__(email) # same as using the below command, it does not take 'self' parameter
# User.__init__(self, email)
def attack(self):
print(f"{self.name} is attacking with {self.power} power.")
wizard1 = Wizard("John", 50, '[email protected]')
print(wizard1.email)