Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

inherit variables of parent

class Person(object):
    def __init__(self, name, phone):
        self.name = name
        self.phone = phone
class Teenager(Person):
    def __init__(self, name, phone, website):
        Person.__init__(self, name, phone)
        self.website=website
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #inherit #variables #parent
ADD COMMENT
Topic
Name
2+9 =