 Let's start discussing object-oriented programming with something everybody understands. Toasters. In order to think in an object-oriented way, you need to think about the things an object has, its properties, and the things an object does, its methods. Usually we start out with properties. What does a toaster have? It has slots, two, three, or four. It has a voltage, one-ten or two-twenty. A number of slices of bread currently in the toaster, from zero to the number of slots. An on-off switch. And a darkness setting, usually from one to ten, where one is death-warmed over and ten is cremation. And here's the corresponding UML diagram for the properties. In terms of methods, we have a constructor. The only two things we need to set ourselves are the number of slots and the voltage. We ship toasters with no bread in them, turned off with the darkness set to one. We'll omit the getters and setters here as there's nothing particularly new in them. What other things does a toaster do? You can turn it on or turn it off. That's a shorthand for set turned on to true or false. You can insert bread. The parameter is a number of slices to insert. And you can pop the bread out, which sets the number of slices to zero. And you can convert the toaster object to a string for display for the users. And here's the code. With the properties, the constructor, the getters and setters. And notice, by the way, that when I set the number of slots, I make sure that it stays in the range one to four. And I make sure that the voltage is either one ten or two twenty. And then the extra methods that I talked about earlier, turn on, turn off, insert bread, and pop bread. And here's two string. Here's some test code. I'm going to create a two-slot toaster that has two slots at 110 volts. And a toaster for Europe with four slots and 220 volts. I'll turn on the two-slot toaster, set its darkness control to four, and insert one slice of bread. And then I'll print out both of them. Let's see what that looks like. And there's my output.