Skip to content

Commit 4474b73

Browse files
author
Vimal
committed
* Updated README.md
1 parent 27bfdbe commit 4474b73

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,29 @@
2323
#### 02. Instances, Instance methods, Instance attributes
2424

2525
------------
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.
2741

2842
------------
2943
#### 04. The __init__ constructor
3044

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+
3149
------------
3250
#### 05. Inheritance (Inheriting {attributes,methods,constructors etc..})
3351

0 commit comments

Comments
 (0)