April 2017
Beginner to intermediate
312 pages
7h 23m
English
In our object-oriented example, the first argument to every method had an argument called self. self refers to the instance of the class in use and the self keyword is used as the first argument in methods that interact with the instances of the class. In the preceding example, self refers to the object student1. It is equivalent to initializing an object and accessing it as follows:
Student(student1, "John Doe", "29", "123 Main Street, Newark, CA") Student.return_address(student1)
The self keyword simplifies how we access an object's attributes in this case. Now, let's review some examples where we make use of OOP involving the Raspberry Pi.
Read now
Unlock full access