I'm trying to have the Child class call and use the Parent's __init__method, what are some other ways to do this other than using the super() method in the Child? I was told to avoid using super() is possible hence I want to know.
# -*- coding: utf-8 -*-
class Room(object):
def __init__(self, current_room):
self.current_room = current_room
print("You are now in Room #{}".format(self.current_room))
class EmptyStartRoom(Room):
def __init__(self, current_room=1):
super().__init__(current_room)
class ChestRoomKey1(Room):
def __init__(self, current_room=2):
super().__init__(current_room)
a_room = EmptyStartRoom()
other_room = ChestRoomKey1()
From the code above I get:
You are now in Room #1
You are now in Room #2