22 Oct 2023




Beginner

In Object-Oriented Programming (OOP), a class is a blueprint for creating objects. It defines the structure and behavior of objects that belong to that class.

Examples:

  1. Class: Car
    • Attributes: Make, Model, Year
    • Methods: Start, Stop, Accelerate
Class: Car
----------------------
Attributes:
- Make
- Model
- Year

Methods:
- Start()
- Stop()
- Accelerate()
  1. Class: Person
    • Attributes: Name, Age, Gender
    • Methods: Walk, Talk, Eat
Class: Person
----------------------
Attributes:
- Name
- Age
- Gender

Methods:
- Walk()
- Talk()
- Eat()