Question: Qn 1) Use only Python Programming language for the below question. Someone made the following class: class Address: def __init__(self, street, num): self.street_name = street
Qn 1) Use only Python Programming language for the below question. Someone made the following class: class Address: def __init__(self, street, num): self.street_name = street self.number = num Sally now wants to make a subclass (child) of the class Address called CampusAddress that has a new attribute (office number), that can vary. This subclass will always have the street attribute set to Hougang and the num attribute set to 77. She wants to use the class as follows: sally_addr = CampusAddress('8745 5951') print(sally_addr.office_number) print(sally_addr.street_name) print(sally_addr.number) Help her implement the CampusAddress class as she doesn't know how.
The below codes might help: class Address: def __init__(self, street, num): self.street_name = street self.number = num
sally_addr = CampusAddress('8745 5951') print(sally_addr.office_number) print(sally_addr.street_name) print(sally_addr.number)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
