Hello.
Welcome to the session on.
Object Oriented Programming.
Object oriented programming is a programming style that is associated with the concept of class objects
and various other concepts revolving around these two.
There are three widely used programming styles.
One is procedural programming.
Functional programming and then Object Oriented Programming.
Python supports all these three programming styles or approaches.
We are interested to know about object oriented programming object oriented programming is an approach
to programming that uses objects and their interactions to design applications and computer programs
object oriented programming models real world things as software objects which have some data associated
with them and can perform certain functions.
For example an object could represent a human being with properties such as name age height weight address
etc. and a human being can perform functions such as walk dog run sleep eat etc..
Another example of an object is a car.
A car can have properties like modern brand car load mileage year of manufacture etc. and some of the
actions that can be performed on the card object.
We can start the engine accelerate the car apply brakes and stop engine being rolled objects have a
property also known as data odd state and they also can perform functions or behavior and the aim of
object oriented programming is to imitate this.
In terms of software so that objects in software have two entities attached to them the data and the
function and object in programming that has two entities attached to it.
One is the data and the other the things that act on this data also known as functions.
The data are called the attributes of the object and the functions attached to the object which act
on the data are called methods method of the object we've been working on a lot of Python objects in
of course for example strings Python strings are objects.
Say for example when we define a variable a in a sine the text like this.
This means a is an object which is binding to this string.
And now we can have methods that act upon this object.
Say for example I'm going to call the method upper
on this object and this is going to change the state all the data contained in this object
similarly integer list flawed boolean are different Python objects so we have discussed that object
oriented programming is associated with the concept of class and object so we know what an object is.
We will talk about a class you can think of a class as an idea for how something should be defined.
So it is something like blueprint for how something should be defined but it doesn't actually provide
a neat ideal content itself.
So here we have defined a class named God and this class gives us a structure to define various objects.
So in this class we have defined some attribute for the object that can be associated with an object
and yet we have a method that acts upon the object or the data and in a class both the data that is
the attribute and the functions or methods that will be operating on this data are bundled as a unit.
And when we define a class only the description for the object is defined.
There is no object created yet so no memory or storage is allocated.
Then the class is defined and when we define a function in Python we use the key word.
Def D E F then we define a class we use the keyword class like this and then we add the name of the
class beginning with a capital letter as soon as we define a class a new class object is created with
the same name.
And this class object allows us to access these different attributes as well as to create new objects
of this class because a class acts like a blueprint we can use this blueprint Greek to create real objects
of this class.
So now let's see how we can create objects of D Class Carl.