Last active
November 24, 2020 16:05
-
-
Save MLWhiz/587e5bad792b49b2894e94653498036a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
class Shape: | |
def __init__(self, name): | |
self.name = name | |
def area(self): | |
pass | |
def getName(self): | |
return self.name | |
class Rectangle(Shape): | |
def __init__(self, name, length, breadth): | |
super().__init__(name) | |
self.length = length | |
self.breadth = breadth | |
def area(self): | |
return self.length*self.breadth | |
class Square(Rectangle): | |
def __init__(self, name, side): | |
super().__init__(name,side,side) | |
class Circle(Shape): | |
def __init__(self, name, radius): | |
super().__init__(name) | |
self.radius = radius | |
def area(self): | |
return pi*self.radius**2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment