equilateraltriangle
How to Create Classes and Subclasses in Python Using super().__init__ Function.
One common point of confusion with many students starting with Object-oriented programming (OOP) would be how to write the __init__ functions within subclasses. This article attempts to make this concept as simple as possible using a couple of shapes. Given these 4 shapes, we will be dealing with 5 classes -- Shape, Rectangle, Square, Triangle and EquilateralTriangle. Here, the Shape class is the parent class. To keep things simple, let's just create 1 attribute num_corners.
Technology: Information Technology > Artificial Intelligence > Representation & Reasoning > Object-Oriented Architecture (0.57)