Hi.
Welcome back.
Today we will discuss at Bluebird the crater delta in the crater airport about bison and property is
built in the crater used to change our class methods or attributes so that the user of our class doesn't
need to make any change in zip code example class fruit decaf double underscore and it does it underscore
self and the name and the color column Zen and instantiation of self to our attributes name self.
The name equal name self color equal color Zen and self-taught fruit type equal self with good name
plus has plus a self that color plus color citrus equal fruit lemon and yellow
print citrus dot name and the brand set as the color and the brand citrus that fruit type.
We will get from the last to code lemon yellow lemon has yellow color.
Okay but when we et cetera that name equal orange Brent citrus a good name and brand citrus color we
will get orange and yellow.
The name attributes gotta change it but the sentence that was created by fruit type attributes remains
same as it was said during the initialization of citrus object so we will use python functions to solve
above problem uh class root column def not an underscore any double underscore or in brackets self and
the name and in the end the color close bracket column self Doc name equality set with the current equal
color and we will cancel the third line through type initialization.
Uh for name and change it to a function called fruit type the fruit type.
So return serve dot name plus has and self blast self color blast color citrus equal fruit lemon and
yellow blend citrus.
The name brand citrus the color brand citrus fruit type method citrus the name Ecuadorians Brent citrus
with name Brent citrus colors.
Let's run our code.
We will get lemon yellow lemon has yellow color orange and yellow.
This solve it but we have removed the fruit type attributes from the constructor and add a method named
for type.
So now in our class there is no attribute to name fruit type and we have a method named fruit type.
And when the any user use our class will be in trouble as they have to replace all attributes fruit
type with a function called fruit type.
Assume we have long code which has lots of lines.
Then how extremely difficult it will be for the coders how extremely difficult it will be for the coders
so we will solve this problem using the buy some property the creator as following add property def
fruit type underscore type self column return sales with name but as the string has been thus self color.
But as the string colors so there could well be as following plus fruit column the F double underscore
any double underscore or mean bracket self.
And name and color close bracket.
Call them self name equal name self the same full of color equal color and we cancel the third line
self that through type admirable.
Dear fruit underscore type I'm in bracket self close bracket column with any self dot name plus string
of space has its base plus self dot color plus of Amber entities space base color global entities citrus
equity fruit lemon and dill brand citrus dot name Brent citrus color brands Brent uh citrus dot fruit
underscore type citrus dot name equal orange with uh all capital citrus dot color equal orange with
oh small four color Brent citrus the name Brent citrus just color Brent citrus that uh fruit uh underscores
type
and when we run our code we will get lemon yellow lemon has yellow color orange audience Orange has
orange color.
Thank you for watching.
See you next lectures by.