- objects and classes
- class is the blue print objects
- class naming is done with first letter as capital
class Student:
name = "cpandu"
s1 = Student()
print(s1.name)
Constructers
- Constructer is also called as init function
- every class have the init function
- Init / constructer is created when the class is created
- init / constructer is executed when the class is initiated
- constructer takes a parameter which is know as self parameter
- default a constructer takes default parameter name called self which points to the object
class Student:
name = "cpandu"
def __init__(self) # this is a constructer
print("hello")
s1 = Student()
print(s1.name)
Attributes
- There are two types of Attributes
- Class Attributes
- object Attributes
Instance or object Attributes are unique for different object attributes (we define them as self. )
methods
- function written inside the object is know as methods