Monday, March 15, 2021

Points to Remember on OOPS in Python

 

  Points to Remember on OOPS in Python

 

* Procedure oriented Programming Approach is the methodology where programming is done using procedures and functions .

 

* Procedure Oriented Programming Approach is generally followed by languages like C , Pascal and Fortran

 

* Python programming can take up programming using procedure oriented approach ( like C ) or Object Oriented Programming Approach ( like Java and C++ ) depending upon requirement .

 

* An object is anything that really exists in the world and can be distinguished from other objects . It is like an entity which has a unique existence and also displays some form of attributes and behaviours.

 

* Every Object has some behaviour that is characterised by attributes and actions . Here , attributes means the manner of conductance of any action . Attributes are represented by variables and actions are performed by methods . So , an object contains variables and methods .

 

* A function which is written inside a class is called as Method .

 

* A Class is a model or Blueprint for the creation of objects . And , a class contains variables and methods .

 

* Objects are created from a Class * An object does nothing without a class , however a class can exist without any object .

 

* Encapsulation is a mechanism where the data ( variables ) and the code ( methods ) that act on the data are bound together .

 

* Class is an example for Encapsulation since it contains both data and code .

 

* Hiding the unnecessary data and code from the user is called as Abstraction .

 

* In order to hide variables or methods , one should declare the variables or methods are private members . This is done by writing two underscores before the names of the variable or the methods .

 

* Private Members can be accessed using "Name Mangling" where the class name is used with single underscore before it and two underscores after it in the form of :

 

instancename._Classname_variable

instancename._Classname_method()

 

 

* Creating new classes from existing classes so that new classes would acquire all the features of the existing classes is called as Inheritance .

 

* In Inheritance , the first class generally created is called as Base Class or Super Class . The newly created Class is called as Sub-Class or Derived Class .

 

* Polymorphism represents the ability of an object or method to assume several different forms

 

* The Programming Languages which follow all the five features of OOPS namely : classes and objects , Encapsulation , Abstraction , Inheritance and Polymorphism are called as Object Oriented Programming Languages . For example: C++ , Java and Python fall into this category of Programming Languages .

 

No comments:

Post a Comment