File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 23
23
#### 02. Instances, Instance methods, Instance attributes
24
24
25
25
------------
26
- #### 03. Class attributes
26
+ #### 03. Class attributes
27
+
28
+ Attributes or methods specific to a class are called Class attributes
29
+
30
+ Example:
31
+
32
+ ~~~
33
+ class MyClass(object):
34
+ value = 10
35
+
36
+ def __init__(self):
37
+ pass
38
+ ~~~
39
+
40
+ Here ` value ` is a class attribute. These are used when certain values need to be set outside a function.
27
41
28
42
------------
29
43
#### 04. The __ init__ constructor
30
44
45
+ The __ init__ () constructor is a magic method which gets called when a class is instantiated.
46
+
47
+ Any attributes set under the __ init__ () constructor will be instantiated at the time of instance creation.
48
+
31
49
------------
32
50
#### 05. Inheritance (Inheriting {attributes,methods,constructors etc..})
33
51
You can’t perform that action at this time.
0 commit comments