Skip to content

Instantly share code, notes, and snippets.

@rdcoder33
Last active December 27, 2018 04:00
Show Gist options
  • Save rdcoder33/d08ef25b706f3042e48cf12044c32072 to your computer and use it in GitHub Desktop.
Save rdcoder33/d08ef25b706f3042e48cf12044c32072 to your computer and use it in GitHub Desktop.
class Rectangle:
sides = 4
all_sides_equal = False
opposite_sides_equal = True
type = 'rectangle'
def area(self):
length = int(input('Enter length: '))
width = int(input('Enter width: '))
return length * width
class Square(Rectangle):
# overriding necessary attributes
all_sides_equal = True
type = 'square'
# overriding area method
def area(self):
side = int(input('Enter Side: '))
return side ** 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment