Calling class member variables works the same whether those values are created within the class (like our car’s
condition) or values are passed into the new object at initialization. We use dot notation to access the member variables of classes since those variables belong to the object.
For instance, if we had created a member variable named
new_variable, a new instance of the class named
new_object could access this variable by saying:
Now that you’ve created
my_car print its member variables:
my_car. Click “Stuck? Get a hint!” for an example.