0% found this document useful (0 votes)
2 views

python assignment5

The document outlines the study of classes and objects in Python, emphasizing their role as blueprints for creating objects. It covers key concepts such as the init() function, str() function, object methods, the self parameter, and the use of the pass statement in class definitions. The conclusion highlights the learning outcomes related to classes and objects in Python programming.

Uploaded by

Kabir Peswani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

python assignment5

The document outlines the study of classes and objects in Python, emphasizing their role as blueprints for creating objects. It covers key concepts such as the init() function, str() function, object methods, the self parameter, and the use of the pass statement in class definitions. The conclusion highlights the learning outcomes related to classes and objects in Python programming.

Uploaded by

Kabir Peswani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

THADOMAL SHAHANI ENGINEERING

COLLEGE

DEPARTMENT OF INFORMATION
TECHNOLOGY

5.Classes and Objects


Aim: To study and implement Classes and objects and
implement inner class, Constructors and Inheritance in
Python.
Theory:
Python is an object-oriented programming language.
Almost everything in Python is an object, with its properties
and methods. A Class is like an object constructor, or a
"blueprint" for creating objects. The init () Function:
The examples above are classes and objects in their simplest
form, and are not really useful in real life applications.
To understand the meaning of classes we have to understand
the built- in init () function.
All classes have a function called init (), which is
always executed when the class is being initiated.
The str () Function:
The str () function controls what should be returned
when the class object is represented as a string.
Object Methods:
Objects can also contain methods. Methods in objects are
functions that belong to the object.

The self Parameter:


The self parameter is a reference to the current instance of the
class, and is used to access variables that belong to the class.
The pass Statement:
class definitions cannot be empty, but if you for some
reason have a class definition with no content, put in the pass
statement to avoid getting an error.
Program with output:
Conclusion:(LO3)
We have learned classes and objects in python language.

You might also like