Professional Documents
Culture Documents
3 Classes and Objectspdf Lyst5481
3 Classes and Objectspdf Lyst5481
① Class
② Attributes
③ Objects
⑥ Class object
⑤ _ _
init _
C) method
_
⑥ Types of methods
⑦ Types of variables
Real
%¥÷÷÷%÷÷
class
Object
←
①
Noun
Common Noun
.
Encapsulating
properties
An act
of combining
and methods related same
Encapsulation
object is known as
to implement
class is a way
encapsulation
Clad
•
class is a description of an object .
Chess Test :
# attributes
attributes ofan
• It defines various
object .
x and f- I
class Test :
are attributes
2C =
5
def fi c) :
# some code
Objects
instance of class
•
Object is an
a
.
→☐
-
Instance object
'
☐
tl = Test C)
Test class
+I = Tests ] objects of
Class Object
-
Test vs Test C)
Test
☐→☐ Class object
has
class object
One class exactly one
objects
Class Test :
Test clan
≠ ☐→☐ object
+ I = Test )
At
}
1- 2 =Test C)
Test C)
→ ☐ instance
+3 =
tz
Objects
→
☐ ☐
① clan object variables
② Instance obje
variables
.µ→gyJ
static variables
iinit__csMethod_
-
Class Test :
init C self ) :
def _
_
-
_
9=5
self .
b 6
self - =
init ( ti )
→ # _ _
Test C)
-
_
£1 =
and b
%→Ñ
a are instance object variables
Methods
•
Instance method
• static method
• class method
static variables
and instance variables
Test
☐→← static
variable
ti
p→t3← instance
variables
1- 2
D→g¥←←
Create a Employee
class with