| S. No. | Aspect | Class | Object |
|---|---|---|---|
| 1. | Definition | Blueprint or template from which objects are created | Instance of a class |
| 2. | Grouping | Represents a group of similar objects | A real-world entity with specific attributes |
| 3. | Nature | Logical entity | Physical entity |
| 4. | Declaration | Declared using the class keyword | Created through the new keyword |
| 5. | Instances | Declared once | Created many times as per requirement |
| 6. | Memory Allocation | Does not allocate memory when created | Allocates memory when created |
Examples:
- Program for laying out a newspaper:
- Catalog store order entry system:
In the newspaper layout program, each class represents a distinct component of the layout, and objects are instances of these classes representing specific elements on a page.
In the catalog store order entry system, the classes represent entities involved in the ordering process, and objects are instances representing specific customers, orders, stores, and items in the system.