Tell us what’s happening:
HI! I’m not asking for help with the project, just clarification on what the .super() method does please.
I used it because that’s what we did for the subclass in the vector space lesson, but I don’t really understand what it’s doing. I’ve searched online and see things like “.super() allows you to call methods from the parent class” but that’s not very specific.
I guess my question is:
I thought defining a subclass meant that subclass automatically inherited the parent class’s methods, and we only need to add new methods. For example:
class Subclass(Parentclass)
def new_method… etc
What does .super() add to this?
Your code so far
class Square(Rectangle):
def __init__(self, side):
super().__init__(width=side, height=side)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Challenge Information:
Build a Polygon Area Calculator Project - Build a Polygon Area Calculator Project