Search
Contents
Classes and Objects
Classes and Objects
ΒΆ
What are Objects
Examples of Objects
Objects Organize Related Code
Check Your Understanding
Why Use Objects?
A Shift in Thinking
Objects Copy Real World Thinking
Phones as Objects
Cooking with Objects
Check Your Understanding
Working With Objects
Object Properties
Calling Methods
Methods vs. Functions
Call Syntax
Methods are Object Specific
Try It!
Classes
Objects Have a Data Type
User Defined Classes
Create a Class
What Classes Do
Design a New Class
Define the New Class
Setting Property Values
Use Parameters with the constructor
Check Your Understanding
Using a Class
Create New Objects
Default Property Values
Another Mental Image for Classes
Adding Methods to a Class
Return to the Class Design
Define a New Method
Add a Method to the
Cat
Class
Return Values
Add Your Own Method
Improving
make_noise()
Check Your Understanding
More Object Details
Printing Objects
The
__str__
Method
Collect All Property Values
Property and Method Names
Using Objects in Functions
Object Scope
Check Your Understanding
Exercises: Classes and Objects
Part 1: Create a New Class
Add Properties to
Robot
Add Methods to
Robot
Part 2: Create Objects
Update Distances
Part 3: Find Oldest Robot
Part 4: Robot Races
Studio: Classes and Objects
Before You Start
Part 1: Add Class Properties and
__str__
Method
Part 2: Add Another Class Method
Part 3: Add More Methods
Calculating the Test Average
Determining Candidate Status
Optional Testing
←
Chapters
What are Objects
→