Name | . (dot) |
||||||
---|---|---|---|---|---|---|---|
Examples |
class HLine(object): # Class definition def __init__(self, ypos, stroke_color): # Object constructor self.ypos = ypos self.stroke_color = stroke_color def display(self): # Display method stroke(self.stroke_color) line(0, self.ypos, width, self.ypos) # Declare and construct two objects (h1 and h2) of the class HLine(object): h1 = HLine(20, 0) h2 = HLine(50, 255) background(127) h1.display() h2.display() | ||||||
Description | Provides access to an object's methods and data. An object is one instance of a class and may contain both methods (object functions) and data (object variables and constants), as specified in the class definition. The dot operator directs the program to the information encapsulated within an object. | ||||||
Syntax | object.method() | ||||||
Parameters |
| ||||||
Related |
Object |
Updated on Tue Feb 27 14:07:12 2024.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License