I'm playing around with python class inheritance, but I can't seem to get the child class working.
The error message that I'm getting here is:
must be a type not classobj
Here is the code:
class User():
"""Creates a user class and stores info"""
def __init__(self, first_name, last_name, age, nickname):
self.name = first_name
self.surname = last_name
self.age = age
self.nickname = nickname
self.login_attempts = 0
def describe_user(self):
print("The users name is " + self.name.title() + " " + self.surname.title() + "!")
print("He is " + str(self.age) + " year's old!")
print("He uses the name " + self.nickname.title() + "!")
def greet_user(self):
print("Hello " + self.nickname.title() + "!")
def increment_login_attempts(self):
self.login_attempts += 1
def reset_login_attempts(self):
self.login_attempts = 0
class Admin(User):
"""This is just a specific user"""
def __init__(self, first_name, last_name, age, nickname):
"""Initialize the atributes of a parent class"""
super(Admin, self).__init__(first_name, last_name, age, nickname)
jack = Admin('Jack', 'Sparrow', 35, 'captain js')
jack.describe_user()
I'm using Python 2.7