Back
Close

Computing with Data

elgeish
137.5K views

Inheritance

Class inheritance in Python is indicated by including the base class in parenthesis after the class name in the class definition:

class Point:
'''Represents a point in a 2-D coordinate space.'''
num_points = 0
def __init__(self, x, y):
Point.num_points += 1
self.x = x
self.y = y
def __del__(self):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants