Python Introduction to OOP

Rumman Ansari   Software Engineer   2022-10-10   518 Share
☰ Table of Contents

Table of Content:


Object-oriented programming can model real-life scenarios and suits developing large and complex applications.

Object

In real life, an object is something that you can sense and feel. For example Toys, Bicycles, Oranges and more.

However in Software development, an object is a non tangible entity, which holds some data and is capable of doing certain things.

Defining Classes

Class

A Class is a template which contains to build an object.

methods that can be used by the object to exhibit a specific behaviour.

class keyword is used to define a class in Python.

Syntax


 class <ClassName>(<parent1>, ... ):
    class_body

Example

 class Person:
    pass

Above example defines Person class without any body.