SlideShare a Scribd company logo
Pythonclass
Pythonclass
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Classes and Objects In Python
●
Shafeeque
●
shafeequemonp@gmail.com
●
www.facebook.com/shafeequemonp pambodan
●
twitter.com/shafeequemonp
●
in.linkedin.com/in/shafeequemonp
●
9809611325
What is a Class?
 A class is simply a representation of a type of object.
 It is the blueprint/ plan/ template that describe the details of an object.
 A class is the blueprint from which the individual objects are created.
 Class is composed of three things: a name, attributes, and operations.
i.e. it can be executed from as many different points in Program as required
What is an Object?
● An object represents a particular instance of a class.
● An Object is a collection of data members and associated member
functions also known as methods.
Class declaration:
Syntax:
Cpp:
class class_name {};
class class_name {
access_specifier_1://public/private/protected
member1;//member variables//member functions
access_specifier_2:
member2;
...
} object_names;
Class definition:
Eg:class
CRectangle {
int x, y;
public:
void
set_values
(int,int);
int area
(void);
}
Class object:
class_name object_name
Eg:CRectangle rect;
rect.x;or rect.set_values();
Class declaration:
java:
class class_name {}
public class Dog
{
String breed;
int age;
String color;
void barking()
{
}
void hungry()
{
}
void sleeping()
{
}
}
Class object:
Dog dog=new Dog();
Using object:
objectReference.methodName(); Here, dog.barking();
dog.hungry();
Python classes and objects:
Creating Classes:
Syntax:
class ClassName:
'Optional class documentation string'
class_suite
● The class has a documentation string which can be access
via ClassName.__doc__.
● The class_suite consists of all the component statements, defining class
members, data attributes, and functions.
Creating and accessing instance objects:
● To create instances of a class, you call the class using class
name and pass in whatever arguments its __init__ method
accepts
● Object name=Class_name()
● Eg:class=Class() accessing:objectname.method()
class Employee:
'Common base class for all employees'
def __init__(self, name, salary):
self.name = name
self.salary = salary
def displayEmployee(self):
print "Name : ", self.name, ", Salary: ",
self.salary
"This would create first object of Employee class"
emp1 = Employee("shafeeque", 2000)
"This would create second object of Employee class"
emp2 = Employee("shameer", 5000)
emp1.displayEmployee()
emp2.displayEmployee()
Name : shafeeque ,Salary: 2000
Name : shameer ,Salary: 5000
If this presentation helped you, please visit our page facebook.com/baabtra and
like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

What's hot (20)

PPTX
[OOP - Lec 04,05] Basic Building Blocks of OOP
Muhammad Hammad Waseem
 
PPTX
Basics of oops concept
DINESH KUMAR ARIVARASAN
 
PPTX
Object Oriented Programming Using C++
Muhammad Waqas
 
PPTX
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
PPTX
Static Data Members and Member Functions
MOHIT AGARWAL
 
PPTX
Java class,object,method introduction
Sohanur63
 
PPT
Java lec class, objects and constructors
Jan Niño Acierto
 
PPTX
Introduce oop in python
tuan vo
 
PPTX
Dev Concepts: Object-Oriented Programming
Svetlin Nakov
 
PPTX
Class or Object
Rahul Bathri
 
PPTX
Advance OOP concepts in Python
Sujith Kumar
 
PDF
Object Oriented Programming Concepts
246paa
 
PPT
Class and object in C++
rprajat007
 
PDF
Python - object oriented
Learnbay Datascience
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PPT
Java oops PPT
kishu0005
 
PDF
Lect 1-java object-classes
Fajar Baskoro
 
PDF
Object oriented approach in python programming
Srinivas Narasegouda
 
PDF
CLASS & OBJECT IN JAVA
Riaj Uddin Mahi
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
Muhammad Hammad Waseem
 
Basics of oops concept
DINESH KUMAR ARIVARASAN
 
Object Oriented Programming Using C++
Muhammad Waqas
 
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
Static Data Members and Member Functions
MOHIT AGARWAL
 
Java class,object,method introduction
Sohanur63
 
Java lec class, objects and constructors
Jan Niño Acierto
 
Introduce oop in python
tuan vo
 
Dev Concepts: Object-Oriented Programming
Svetlin Nakov
 
Class or Object
Rahul Bathri
 
Advance OOP concepts in Python
Sujith Kumar
 
Object Oriented Programming Concepts
246paa
 
Class and object in C++
rprajat007
 
Python - object oriented
Learnbay Datascience
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Java oops PPT
kishu0005
 
Lect 1-java object-classes
Fajar Baskoro
 
Object oriented approach in python programming
Srinivas Narasegouda
 
CLASS & OBJECT IN JAVA
Riaj Uddin Mahi
 
Ad

Similar to Pythonclass (20)

PPTX
IPP-M5-C1-Classes _ Objects python -S2.pptx
DhavalaShreeBJain
 
PPTX
software construction and development week 3 Python lists, tuples, dictionari...
MuhammadBilalAjmal2
 
PPTX
Python-Classes.pptx
Karudaiyar Ganapathy
 
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
PDF
Python Programming - Object-Oriented
Omid AmirGhiasvand
 
PPTX
Object Oriented Programming Class and Objects
rubini8582
 
PDF
python note.pdf
Nagendra504676
 
PPTX
Object oriented Programming in Python.pptx
SHAIKIRFAN715544
 
PPTX
Class_and_Object_with_Example_Python.pptx janbsbznnsbxghzbbshvxnxhnwn
bandiranvitha
 
PPTX
Module-5-Classes and Objects for Python Programming.pptx
YogeshKumarKJMIT
 
PDF
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov
 
PPTX
Object oriented Programming concepts explained(3).pptx
grad25iconinfocus
 
PPTX
Object-Oriented Programming in Python.pptx
ssuser4ab3a2
 
PPTX
Object in python tells about object oriented programming in python
ReshmiShaw2
 
PPTX
Object Oriented Programming.pptx
SAICHARANREDDYN
 
PPTX
مقدمة بايثون .pptx
AlmutasemBillahAlwas
 
PDF
introductiontooopinpython-171115114144.pdf
AhmedSalama337512
 
PPTX
Introduction to OOP in Python
Aleksander Fabijan
 
IPP-M5-C1-Classes _ Objects python -S2.pptx
DhavalaShreeBJain
 
software construction and development week 3 Python lists, tuples, dictionari...
MuhammadBilalAjmal2
 
Python-Classes.pptx
Karudaiyar Ganapathy
 
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
Python Programming - Object-Oriented
Omid AmirGhiasvand
 
Object Oriented Programming Class and Objects
rubini8582
 
python note.pdf
Nagendra504676
 
Object oriented Programming in Python.pptx
SHAIKIRFAN715544
 
Class_and_Object_with_Example_Python.pptx janbsbznnsbxghzbbshvxnxhnwn
bandiranvitha
 
Module-5-Classes and Objects for Python Programming.pptx
YogeshKumarKJMIT
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov
 
Object oriented Programming concepts explained(3).pptx
grad25iconinfocus
 
Object-Oriented Programming in Python.pptx
ssuser4ab3a2
 
Object in python tells about object oriented programming in python
ReshmiShaw2
 
Object Oriented Programming.pptx
SAICHARANREDDYN
 
مقدمة بايثون .pptx
AlmutasemBillahAlwas
 
introductiontooopinpython-171115114144.pdf
AhmedSalama337512
 
Introduction to OOP in Python
Aleksander Fabijan
 
Ad

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
PDF
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 3 stored procedures
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 

Recently uploaded (20)

PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Horarios de distribución de agua en julio
pegazohn1978
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 

Pythonclass

  • 3. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. Classes and Objects In Python ● Shafeeque ● [email protected] ● www.facebook.com/shafeequemonp pambodan ● twitter.com/shafeequemonp ● in.linkedin.com/in/shafeequemonp ● 9809611325
  • 5. What is a Class?  A class is simply a representation of a type of object.  It is the blueprint/ plan/ template that describe the details of an object.  A class is the blueprint from which the individual objects are created.  Class is composed of three things: a name, attributes, and operations. i.e. it can be executed from as many different points in Program as required What is an Object? ● An object represents a particular instance of a class. ● An Object is a collection of data members and associated member functions also known as methods.
  • 6. Class declaration: Syntax: Cpp: class class_name {}; class class_name { access_specifier_1://public/private/protected member1;//member variables//member functions access_specifier_2: member2; ... } object_names; Class definition: Eg:class CRectangle { int x, y; public: void set_values (int,int); int area (void); } Class object: class_name object_name Eg:CRectangle rect; rect.x;or rect.set_values();
  • 7. Class declaration: java: class class_name {} public class Dog { String breed; int age; String color; void barking() { } void hungry() { } void sleeping() { } } Class object: Dog dog=new Dog(); Using object: objectReference.methodName(); Here, dog.barking(); dog.hungry();
  • 8. Python classes and objects: Creating Classes: Syntax: class ClassName: 'Optional class documentation string' class_suite ● The class has a documentation string which can be access via ClassName.__doc__. ● The class_suite consists of all the component statements, defining class members, data attributes, and functions. Creating and accessing instance objects: ● To create instances of a class, you call the class using class name and pass in whatever arguments its __init__ method accepts ● Object name=Class_name() ● Eg:class=Class() accessing:objectname.method()
  • 9. class Employee: 'Common base class for all employees' def __init__(self, name, salary): self.name = name self.salary = salary def displayEmployee(self): print "Name : ", self.name, ", Salary: ", self.salary "This would create first object of Employee class" emp1 = Employee("shafeeque", 2000) "This would create second object of Employee class" emp2 = Employee("shameer", 5000) emp1.displayEmployee() emp2.displayEmployee() Name : shafeeque ,Salary: 2000 Name : shameer ,Salary: 5000
  • 10. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 11. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: [email protected]