Example HTML page

OOP in Python

Introduction:

In Python there are two approaches for problem solving; Procedural and Object Oriented. The first approach i.e., Procedural allows us to solve complex issues but in the case of code organizing and its readability becomes difficult here. On the other hand, object oriented is another approach where the code organizing and code readability is better than the previous approach.

In Object Oriented Programming (OOP) there are having two key terms are:

1.Class:

It is a collection or category of things/attributes which will characterize any object resides in that class. Technically a class is defined as a blueprint for individual objects. A class comprises of class variables and instance variables and these are accessed through “ . “ operator/dot operator.

2.Object:

An object is an instance of a class. An object will perform the functionalities whichever defined in that class. An object also has class variables and instance variables and methods.

Ex: In real time, for example ‘Car’ is a class and ‘Toyota’ is instance of that class i.e an object in OOP.

Classes and Objects:

A Class provides a way to construct Objects from the similar class. It is a prototype or blueprint from which the individual objects can be created.

Ex: Creating ‘Student’ class and three objects for that class.

In object oriented programming, there are four basic concepts.

  1. Abstraction
  2. Polymorphism
  3. Encapsulation
  4. Inheritance
Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest