Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Instance Method With Property In Python

class Car:

    def __init__(self, type, color):
        self.type = type
        self.color = color

    def get_description(self):
        print("This vehicle is a {} {}".format(self.color, self.type))
    

c = Car("Honda", "blue")
c.get_description()
 
PREVIOUS NEXT
Tagged: #Instance #Method #With #Property #In #Python
ADD COMMENT
Topic
Name
4+8 =