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

PPTX
[OOP - Lec 09,10,11] Class Members & their Accessing
PPTX
[OOP - Lec 18] Static Data Member
PPT
Class and object in c++
PPTX
[OOP - Lec 19] Static Member Functions
PPTX
Python - OOP Programming
PDF
Python Class | Python Programming | Python Tutorial | Edureka
PPT
Object and class
PDF
ITFT-Classes and object in java
[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 18] Static Data Member
Class and object in c++
[OOP - Lec 19] Static Member Functions
Python - OOP Programming
Python Class | Python Programming | Python Tutorial | Edureka
Object and class
ITFT-Classes and object in java

What's hot (20)

PPTX
[OOP - Lec 04,05] Basic Building Blocks of OOP
PPTX
Basics of oops concept
PPTX
Object Oriented Programming Using C++
PPTX
Object Oriented Programming_Lecture 2
PPTX
Static Data Members and Member Functions
PPTX
Java class,object,method introduction
PPT
Java lec class, objects and constructors
PPTX
Introduce oop in python
PPTX
Dev Concepts: Object-Oriented Programming
PPTX
Class or Object
PPTX
Advance OOP concepts in Python
PDF
Object Oriented Programming Concepts
PPT
Class and object in C++
PDF
Python - object oriented
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
PPT
Java oops PPT
PDF
Lect 1-java object-classes
PDF
Object oriented approach in python programming
PDF
CLASS & OBJECT IN JAVA
[OOP - Lec 04,05] Basic Building Blocks of OOP
Basics of oops concept
Object Oriented Programming Using C++
Object Oriented Programming_Lecture 2
Static Data Members and Member Functions
Java class,object,method introduction
Java lec class, objects and constructors
Introduce oop in python
Dev Concepts: Object-Oriented Programming
Class or Object
Advance OOP concepts in Python
Object Oriented Programming Concepts
Class and object in C++
Python - object oriented
Basic Concepts of OOPs (Object Oriented Programming in Java)
Java oops PPT
Lect 1-java object-classes
Object oriented approach in python programming
CLASS & OBJECT IN JAVA
Ad
Ad

Similar to Pythonclass (20)

PPTX
IPP-M5-C1-Classes _ Objects python -S2.pptx
PPTX
software construction and development week 3 Python lists, tuples, dictionari...
PPTX
Python-Classes.pptx
PPSX
OOPS Concepts in Python and Exception Handling
PDF
Python Programming - Object-Oriented
PPTX
Object Oriented Programming Class and Objects
PDF
python note.pdf
PPTX
Object oriented Programming in Python.pptx
PPTX
Class_and_Object_with_Example_Python.pptx janbsbznnsbxghzbbshvxnxhnwn
PPTX
Module-5-Classes and Objects for Python Programming.pptx
PDF
Anton Kasyanov, Introduction to Python, Lecture5
PPTX
Object oriented Programming concepts explained(3).pptx
PPTX
Object-Oriented Programming in Python.pptx
PPTX
Object in python tells about object oriented programming in python
PPTX
Object Oriented Programming.pptx
PPTX
مقدمة بايثون .pptx
PPTX
Object Oriented Programming - Copy.pptxb
PDF
introductiontooopinpython-171115114144.pdf
IPP-M5-C1-Classes _ Objects python -S2.pptx
software construction and development week 3 Python lists, tuples, dictionari...
Python-Classes.pptx
OOPS Concepts in Python and Exception Handling
Python Programming - Object-Oriented
Object Oriented Programming Class and Objects
python note.pdf
Object oriented Programming in Python.pptx
Class_and_Object_with_Example_Python.pptx janbsbznnsbxghzbbshvxnxhnwn
Module-5-Classes and Objects for Python Programming.pptx
Anton Kasyanov, Introduction to Python, Lecture5
Object oriented Programming concepts explained(3).pptx
Object-Oriented Programming in Python.pptx
Object in python tells about object oriented programming in python
Object Oriented Programming.pptx
مقدمة بايثون .pptx
Object Oriented Programming - Copy.pptxb
introductiontooopinpython-171115114144.pdf

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

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

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Cell Structure & Organelles in detailed.
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
master seminar digital applications in india
PPTX
Lesson notes of climatology university.
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Cell Types and Its function , kingdom of life
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Pharma ospi slides which help in ospi learning
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
Microbial disease of the cardiovascular and lymphatic systems
O5-L3 Freight Transport Ops (International) V1.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
VCE English Exam - Section C Student Revision Booklet
Cell Structure & Organelles in detailed.
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Pre independence Education in Inndia.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
master seminar digital applications in india
Lesson notes of climatology university.
GDM (1) (1).pptx small presentation for students
Module 4: Burden of Disease Tutorial Slides S2 2025
Cell Types and Its function , kingdom of life
Final Presentation General Medicine 03-08-2024.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Pharma ospi slides which help in ospi learning
O7-L3 Supply Chain Operations - ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPH.pptx obstetrics and gynecology in nursing

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 ● shafeequemonp@gmail.com ● 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: info@baabtra.com