Inheritance


#1

class Equilateral(Triangle):
angle = 60
def init(self):
self.angle1= self.angle
self.angle2= self.angle
self.angle3= self.angle

my question is about self.angle
self.angle=60, right?
why we don't put " self.angle= angle" first?


#2

angle is declared as a class variable. whereas self.angle1, etc. are instance variables. A class variable belongs to the class. Every instance will have this variable and its set value. Instance variables belong only to their instance object, and may be unique from other instances.


#3

got it, thank you :slightly_smiling: