Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Easy to read and understand for exams, Study notes of Computer Science

Please download n help! , easy to read

Typology: Study notes

2023/2024

Available from 12/10/2024

neha-gupta-28
neha-gupta-28 🇮🇳

3 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Object oriented programming language
Why is python called a multi paradigm programming language ?
It supports object oriented , procedure oriented ,
functional programing and imperative programming to
write the code hence it is called as multi paradigm
programming language
1. Object oriented programming
It is a program paradigm that focuses on objects and their
interactions rather than just the procedural steps to solve
the problem
It has the data fields associated and functions to
communicate with each other
The basic concepts are
a. Class
It is the blueprint for creating objects which
contain attributes [ data ] and methods [ functions
]
b. Object
It is an instance of a class that contains the
actual data
c. Encapsulation
It is a method of combining the data and functions
inside the class
d. Abstraction
It reduces the complexity by binding the
implementation details and only showing the
relevant information to the user
pf3
pf4

Partial preview of the text

Download Easy to read and understand for exams and more Study notes Computer Science in PDF only on Docsity!

Object oriented programming language

Why is python called a multi paradigm programming language? ➔ It supports object oriented , procedure oriented , functional programing and imperative programming to write the code hence it is called as multi paradigm programming language

  1. Object oriented programming ➔ It is a program paradigm that focuses on objects and their interactions rather than just the procedural steps to solve the problem ➔ It has the data fields associated and functions to communicate with each other ➔ The basic concepts are a. Class ➔ It is the blueprint for creating objects which contain attributes [ data ] and methods [ functions ] b. Object ➔ It is an instance of a class that contains the actual data c. Encapsulation ➔ It is a method of combining the data and functions inside the class d. Abstraction ➔ It reduces the complexity by binding the implementation details and only showing the relevant information to the user

e. Inheritance ➔ The ability of a new class to inherit properties and behavior from an existing class f. Polymorphism ➔ It is the ability to exist in more than 1 form Class variables or class attributes ➔ They are defined outside any methods and are shared among all instance of a class ➔ The instance variables are declared inside a method using a self keyword Methods ➔ These are defined inside a class and are used to perform actions on the class data ➔ Different types of methods are

  1. constructor method ➔ It is automatically called when the instance of the class is created ➔ It is used to initialize the attribute of the instance , the constructor method is called as _ _ init _ _ Initializing of process of creating a class ➔ The first parameter of a constructor method is always self which means the object is being created and is used to initialize the instance of variables
  2. Class level method ➔ It is called as a class rather than the instance of class where the self method is used
  3. Instance method
  1. It is followed by the word init which is prefixed and suffixed with double underscore with a pair of brackets
  2. It takes the 1st arg to initialize the values to the instance variable Types of constructors
  3. Default ➔ It is a constructor that takes no parameters , it is automatically created in python , if no constructor method is defined in the class , which means an empty constructor has no code and does not perform any task but only initializes the object
  4. Parameterized ➔ It is a constructor that takes parameter and is used to initialize attributes or instance variables of an object when it is created
  5. Non parameterized ➔ A constructor without any arguments which is used to only initialize each object with a default value ( 0 ) a. Encapsulation b. Polymorphism c. Inheritance d. Data hiding e. Super class