Various Definitions of a Class
(from a number of websites around the Internet)
- A class is a blueprint or prototype from which objects are created
- From java.sun.com
- A class is a template that defines what attributes an object can have.
Analogy: Cookie cutter and cookies. A cookie cutter is like a class definition. It isn't a cookie, but can be used to create a cookie. Each cookie can will have the same attributes (shape), but each cookie can have different values for the attributes (type of dough, thickness, ...).
- From leepoint.net
- Think of a class as a cookie cutter and an instance as a actual cookie. You use the cookie cutter to stamp the cookie out. With classes, stamping out the class instances is called instantiation.
- From Python Programming with the Java Class Libraries
- Classes are used to create objects, just like cookie cutters are used to create cookies. After an object is made, it keeps a basic "outline" of what it is, but you can make simple modifications too it. After a cookie is made, it keeps it's same shape, but you can add frosting to it.
- From RobKeplin.com
- A class is like a mold or cookie cutter: cookies are made with a cookie cutter in the same way that objects are made from a class. The class (cookie cutter) defines what the objects (cookies) look like.
- From coderanch.com
- The relationship between a class and an object or instance is rather like that of a cookie cutter and cookies. Like a cookie cutter, a class is a shape, with which creates many individual objects.
- From www.cse.lehigh.edu