Skip to content

Commit c9d90e0

Browse files
author
zhangxiaochen
committed
class nature
1 parent b28a832 commit c9d90e0

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

1.5_lesson5.ipynb

+35-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Function & Class"
7+
"# More structureeFunction & Class"
88
]
99
},
1010
{
@@ -532,6 +532,9 @@
532532
" \"\"\"\n",
533533
" a car class\n",
534534
" \"\"\"\n",
535+
" # __init__ is initializing function\n",
536+
" # it's called, when you run a = car(150)\n",
537+
" # 150 is the parameter passed as arg speed_limit\n",
535538
" self.seat_belt_on = False\n",
536539
" self.speed = 0\n",
537540
" self.speed_limit = speed_limit\n",
@@ -767,6 +770,37 @@
767770
"car1.brake()"
768771
]
769772
},
773+
{
774+
"cell_type": "markdown",
775+
"metadata": {},
776+
"source": [
777+
"car is a class, car1 is an obeject of class car."
778+
]
779+
},
780+
{
781+
"cell_type": "code",
782+
"execution_count": 87,
783+
"metadata": {},
784+
"outputs": [
785+
{
786+
"name": "stdout",
787+
"output_type": "stream",
788+
"text": [
789+
"<class '__main__.car'>\n"
790+
]
791+
}
792+
],
793+
"source": [
794+
"print(type(car1))"
795+
]
796+
},
797+
{
798+
"cell_type": "markdown",
799+
"metadata": {},
800+
"source": [
801+
"This intuitive way of programing an object is called objective oriented programing(oop), small wonder oop is heavily used in gaming industry"
802+
]
803+
},
770804
{
771805
"cell_type": "code",
772806
"execution_count": null,

0 commit comments

Comments
 (0)