Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

The Four Pillars of OOP in Python 3 for Beginners

CLASSES AND OBJECTS

1. What is a class ?
A class is logical grouping of attributes(variables) and
methods(functions)
Syntax:
class ClassName:
# class body
Example:
class Employee:
# class body

2. What is an object ?
Object is an instance of a class that has access to all the
attributes and methods of that class
Syntax:
objectName = ClassName()

Example:
employee = Employee()
# The object employee now has access to all the
attributes and methods of the class Employee. You will be
learning more about attributes and methods in the next section.

3. What is object instantiation ?


The process of creation of an object of a class is called
instantiation

Created by Febin George

You might also like