Professional Documents
Culture Documents
PROGRAMMING
Lecturer: MA Lam Hong Thanh
GROUP 3
OBJECT
DEFINITION
Declaration
Content ACCESS
MODIFIERS
OBJECT ELEMENTS
Class definition
Example:
Iphone, samsung, xiaomi, nokia
belong to the smartphone class
Clockwatcher, Alarm clock,
Wristwatch belong to the clock class
Object definition
Class Mercedes
Lamborghini
car
BMW
Class declaration
class TenLop:
‘’properties declaration
dacdiem1
dacdiem2
dacdiemn
//method declaration
def PhuongThuc1( ):
def PhuongThuc2( ):
Class declaration
Object declaration
class Cnhanvien:
def __init__(self, ms, hoten, ngay)
self.id=ms
self.name=hoten
self.date=ngay
A=Cnhanvien('12','truong van A','22/2/2002')
Optional
The self keyword indicates that this is a property or method of the object (you
can use another keyword instead as long as it is at the beginning of the
parameter list):
class MyClass:
a = 10
def func(self):
```noi dung ham
ob = MyClass()
ob.func()
Thank you for listening!