Last active
December 28, 2018 04:47
-
-
Save rdcoder33/f1344c42dbe082375a4c2d2256982192 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
from abc import ABC, abstractmethod | |
class Shape(ABC): | |
@abstractmethod | |
def area(self): | |
pass | |
@abstractmethod | |
def perimeter(self): | |
pass | |
class Square(Shape): | |
def __init__(self, side): | |
self.side = side | |
def area(self): | |
return self.side ** 2 | |
shape_obj = Shape() | |
square_obj = Square(5) | |
print(square_obj.area()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment