You are currently viewing Introduction Of Object Oriented Programming (OOP) In Python 3.7
Object Oriented Programming

Introduction Of Object Oriented Programming (OOP) In Python 3.7

Object oriented programming  (OOP) are computer programming that developer use in developing a good software. Object oriented programming  (OOP) are the model that well organize the software design around the data or object, instead of function and login operations. A object can define the data field which have unique attribute and behavior.

 In computer programming there are two way to manipulate data in other word organize the data structure before the process. One is OOP the second one logic and functionality. This approach is suitable for developing a program. The oop is used when developers are developing the large size of project. The project divided into the groups.

Diffirent Between Object oriented programming  (OOP) And Procedural Programming.

Object oriented programming  (OOP)

  • Use object and classes
  • Easy to add and update data in class
  • Good  organize project
  • Object are manage and pass the data.
  • Easily addition for new developer.
  • Example of Object Oriented Programming are java, c ++, c#, php, ruby, swift and python.

procedural Programming

  • Use functions and logics
  • Not Easy to add and update data in function and module.
  • its not well organize for large organization project
  • Module and functions  are manage and pass the data.
  • Difficulty addition for new developer.
  • Example are the procedural programming are COBOL, Basic, Pascal and c.

Components of OOP In Python :

In computer programming languages the object oriented programming (OOP) are consist the some special components without these components you can’t create a OOP. The OOP exercise accept the challenge to solve the problems. Following are the Object Oriented Programming components, we will understand these by sequence.

  • Class : A class is use for object that consist of number of arguments. For example if you create a travelling application , you need to create your first class with the name of cab.

Syntax :

Class cab {

};

  • Instant : In a simple word instant is a place where argument are declare.
  • Function : Function are  the set of different variables.
  • Class Variable : Class variable are use within the class which shared the  instant class.
  • Data Member : The class variable or object have a specific data which define inside the function are called data member.
  • Method : The specific kind of function which is define inside the class called method.

Creating A Class :

Here I clear OOP concept with a simple example suppose you want to make a employee payroll application in python. And here  you manage this using class object. So what will be your program structure. First of all you need to create employee profile, designation profile and department. your class object structure should be like this. 

OBJECT ORIENTED PROGRAMMING

Example#02 Creating A Class With Attributes:

object oriented programming

Example#02 Create Child Class In Main Class :

Object Oriented Programming

Object Oriented Programming use DRY word its mean don’t repeat yourself. For example all the employee object have the name, department,designation, and date of joining variables value will vary depending on employee instant. But the other hand the class attribute have the same value for all class instant for example basic pay of the same designation will remain the same. So here you can define the class attribute with  assign the value before the

def __init__(self, name, designation, pay).
 

This Post Has 5 Comments

Comments are closed.