Notes - OOPs in Python
Notes - OOPs in Python
'
alowinap
**********V.
' '
Whod is Class f
elass isa bluepuin sek st i inatuet
ics build a »pecisic Pe ookjes. I4ir **
colo7blue"
model "s po
tdoba
In 8nakec
decaleulate_avy-speed(k,time);
ASome code.
Privede '****'**************
deflt *****
**** ****
puolic e deult.
(Cecupie mone. APace. Cccuple.ess Papacc
**** ' ' *
***** ****'*****
* * *********** * *
OPallie2:
Pteeted
***************
Synde»
Class Layi.
tlang="C." . ****'* ''*''**"****
-secondn4= "Pu/hon
-Hind Iamep Java
Punng.ftasle )
pun Lap-3econ
Aunt (LaneyLem-kiadla)we on acces pouiafe
MadhiA.
Constueray:he k sconstauetuay
isto inialize(amign value) to the, data.memkery
ot he eloos whenanjees. he class.
ereated n ekan -init-) method Ls.collel
****''''''* ''*******''**** ''*'* '***'****'****'****** *'* *****
t e constoucw and is calles when an
okject ls oekd.
Sntay
eefit-oe):
*** '''*'**
oamekeruzed Covstnc
* **** ' ' ' '
? Ita r angune
S.9eTEAEnce eInstance beinge Constuceled
knotal'nas 3e).ms the 7est the aparMeg
One Pwided..ethe engramen
eteotad .
Eakel,
' *'**
3/Metods The Faoypose amehoe is t Pocess
e vauahlez. paovdedina elase a in the
nekhsd. Te Mekhods
Tnsavee melhads. **''******' **** *
3lahe methsh.
**'**'*********** *** * *******'********'**********
methads wel.act.upon.he.insfance.varades
e dass. Tndance methada are boun
instance ( okject) and hence celled a
sfaneename. med C. Wkale CaXtnse the Ktance
metsds,we ne ed nt Pas yelne
hesef vrable
Aaezsa Methsis3E.SimP ..CcesSS. Aead
dloda di he. varuaea The..de net madiy the2
dedes in the vniaelea also edllelas gete
mehads. der geSName (Selt) '**'
e o n selftiome
34 * * *
sefame name
7
3Class Meld: Ciass meeds ***''**
are
****''**'*'
the
**°*''*'''*
mebeds
threh act on the elass yarualsles gakie variables.
These metds are wten usinge easgmehd ***'''*** ***
****'''*
' * * * *** **** ****'***' *** *** ** *** *** *****
******** ****:'' **' ' .
kedunes aO. *'''*'*** ' '**'*******'*** * * ' ' ' * * ' **'**''*'*** ' ' ' '' * * * ' ' ' ' ' .
'******
****
* **'**
41 Tmcfbng Overdardi'vapa Funettova overkeodin
stheFAocess when te ame fn eHons an e
uee mulliple timeg bassne O ddteen
nambe oamefey as argamens.5Ptho
doe not suppatuneons oveWmedinp An
eoa Aes thnown we implene heduncton
averedinop
.
bu does ne
.
man thee is no sther ******
ass.Mame
de nl3sltet-tNene,P=None, .
ojecadd_(selPattery e t HodielselP,otker * *
*jec-.
aothe)|%=oject imod(etöthormrub|)
jecgecd (>elhher) **=ofecip(selG ther)
*****'** '***''
. . . ****
10
elases rom the
Inheritance e envínep
N
new
* *
clas Peuvaloss (ageCla)
T ' ' ' * * * * * ' ' * * * ' ' * ' * ' ' ' ' * ' ' * ' ' * * *
- TErd
***** ***T''
-2ingle BenileeDeruvim .
one 0 nee
12sm * * ' * *
multiple base clsges
* * ' * ' ' * * * *
is calles ruulHple ***'*
. *
11
mefasd
per ***'**'
class consue *********** '*** ********'***
sino the super
Super) Conn we s
Supex .-init-C) #call super ekllaclees comtnetn ... .
Tnherbtnce Tmpkism
OPplel clasg eppltel t metnds
**** *
4Eneulaliou I descubes he ide d o
appin de ndhe melhrde thsu wo
on dodawiin one uniThs Puls restuchbng
on acceing vauiableand mePods dineeg and
an paevent the acidertal merdnicaon å oaa,
**** * * * * ' * ***
ile Yes No No
Pruteehek Yes Yes Nd.
Pulaie Yes Yes Ye
' :
. ..
''*' *'''*'*
' ' '''
no ac jmpoa ABB
'**'''''*'*''*
elasss ClasswameCAEC)
*'''****'*' ' ' ' '*''''* **
AbstraeHon Encapaulalion.
O Abstroetion wOrks on. O Eeopsulotion uaks the ' ' ' * * * * ' * T *' ' ' '' '*** ' ' ' ' * ' ' * ****
14
BMise Guesthiom on 00R In R{honL
5 DHerence bekween Bocesural A otjecdes ** ******'*
Oruenek prap-avmiu
ocedoo oprsmmu, |ea0rferdted Popa z
i s e s s seqae. ***"
ata din s oaible
than OD
******
***''****** '*'*'''*''** in Oeckotedes powu
''''**
****
Y''***** *********:
due to akbachon
**** **
* * * Tolos botom-np
CPPach Ppreachy
i s suelwe-aiented) * *
is okjeet-asienteL
****** **':***
** '****'''**'**'***
****
*''***
15
g nn(atage, If also en înterposted
anaaage i ues ine-bfline ex
Wh ts siite in Tuen ?
slte s etthe a gimple stateme in one
Cllechon
' ' '*
modules he Jetoy contarns
**'** *'*****'*
*******''*' ''"*
* * *
potomefer e t e e n e E to
he * * * * * ****
a
theCOUent
' * ' ' * ' * ' ' ' ' * ' ' ' ' **********'*
hsnce. *''***
h e class, anAl
a n d s . s e d o . acce.VAuaLletat
belonga
**** ********* he.closs.
PYerene beueen Rekin and
* **
1
Wha does k s and * Kuna mean?
Whe you aie not clear bou mane
agumets you nerd to pass to paKeular
func tonS, then we Ae k a n and kwor
vaued
hemgs akewd reptesenbs
a
hond livg
10wWhat te hon p 3
PYTtONPATH ts an enviromen vasvalle
whtch you Can set to add dditiovo
diettories whee Pthon ul Saok. o
wodules and packages.
.. .
. . . .. . ... . . . . * * * * **** **
********"***'**'''*'***'*
. . ** *** * * * * * * * * * * * * * * * * ' ' * * * * ' ' ' * * * * ' 1 * * * ' * * * * * * * * * * * ' * * * * * * * * * * ' * * * * * " ' * * * * * ' ' * * * * ' ' ' ' * ' '
***''''** ''*****
****
***
19