From the course: Programming Foundations: Object-Oriented Design

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Classes

Classes - Python Tutorial

From the course: Programming Foundations: Object-Oriented Design

Start my 1-month free trial

Classes

- Objects don't just magically appear in a program. We have to create them, and we do so from classes. A class is the detailed description, the definition, the template of what an object will be. but it isn't the object itself. Once we've written a class and defined it, we can use it to create as many objects based on that class as we want. Different classes let us create different types of objects. - Classes are like our collection of cookie cutters. This particular cutter would be the class to create circular cookies. It defines how the cookie will look. But the cutter itself is not a cookie. And we only need this one cutter to create a tray full of round cookies, each a separate object ready for the oven. - Remember that the class always comes first. You can't make round cookies without the circular cutter. Now, there are three components that make up a class in object-oriented programming. Each class has a name, literally what is it? For example, a round cookie. A class can have…

Contents