Objects and Classes
- Some Examples of Objects:
- Printer
- Table
- Car
- Pen
- Computer
- What can be an object:
- Any thing that can be object which has
- Characteristics => What this object does
- Contents/Attributes => What it has
- Printer
- Characteristic => Print, Switch On/Off, Connect to a network
- Contents/Attributes => Ink, Paper, Machine, Power Supply
- Car
- Characteristics => Commute, Start, Stop
- Contents/Attributes => Colour, Make, Tyres, Engine,
- Any thing that can be object which has
- An object is a data structure that contains data (attributes) and methods (Characteristics)
- A class is a specification of object. Objects are created from classes.
- In python everything is an object
- Lets try to create some Classes
- In Python Class Names should follow Pascal Case
- Refer Here for the sample Printer class skeleton
Lets Design Classes For Movie Ticketing Platform
- The following will be classes
- Movie: This class will have necessary information to contain a Movie
- Theatre: This class will have necessary information to contain a Theatre
- Screen: This class will represent the screen in the theatre
- Seat: This class represents the seat for sale
- User: This class will represent a User booking movie tickets
- Ticket: This class represents a ticket given to the user
Lets Design Classes for Super Market POS (Point of Sale)
- The following will be classes
- Product: This class represents product for sale
- Customer:
- Employee:
- Bill
- Feedback
- Inventory
- Branch:
Lets Design Classes for the Library Management System
-
The following will be the Classes
- Book:
- Librarian:
- Student:
- Register:
- Magazines:
- E-Book:
- NewsPaper:
- Faculty:
- Inventory:
- LibraryCard:
-
Given the Business problem, we can list some of the classes.
-
Classes may have relationship b/w them
-
Each class will have
- Characteristic/Behaviour/Method
- Attribute/Data
-
Sign up for Visual Paradigm Refer Here