Object Oriented Programming/Properties

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Properties in OOP are also able to be looked at as functions, a property houses a function that can have its procedures or variables altered without directly going to the code and editing it. A property can be changed or updated based on user input which allows for a lot of user-interactive programs and applications.

class Marker():

def marker_color(self):
    return self._marker_color

def color(self, color):
    self._marker_color = Blue
    self._marker_color = Red

See also[edit | edit source]