Skip to content

Commit 2e0f689

Browse files
committed
12jun18
0 parents  commit 2e0f689

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"toc": true
7+
},
8+
"source": [
9+
"<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
10+
"<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Object-Oriented-Programming\" data-toc-modified-id=\"Object-Oriented-Programming-1\"><span class=\"toc-item-num\">1&nbsp;&nbsp;</span>Object Oriented Programming</a></span><ul class=\"toc-item\"><li><span><a href=\"#Terminologies\" data-toc-modified-id=\"Terminologies-1.1\"><span class=\"toc-item-num\">1.1&nbsp;&nbsp;</span>Terminologies</a></span><ul class=\"toc-item\"><li><span><a href=\"#Class:\" data-toc-modified-id=\"Class:-1.1.1\"><span class=\"toc-item-num\">1.1.1&nbsp;&nbsp;</span>Class:</a></span></li><li><span><a href=\"#Class-Variables:\" data-toc-modified-id=\"Class-Variables:-1.1.2\"><span class=\"toc-item-num\">1.1.2&nbsp;&nbsp;</span>Class Variables:</a></span></li><li><span><a href=\"#Instance-Variables:\" data-toc-modified-id=\"Instance-Variables:-1.1.3\"><span class=\"toc-item-num\">1.1.3&nbsp;&nbsp;</span>Instance Variables:</a></span></li><li><span><a href=\"#Data-Members:\" data-toc-modified-id=\"Data-Members:-1.1.4\"><span class=\"toc-item-num\">1.1.4&nbsp;&nbsp;</span>Data Members:</a></span></li><li><span><a href=\"#Function-Overloading:\" data-toc-modified-id=\"Function-Overloading:-1.1.5\"><span class=\"toc-item-num\">1.1.5&nbsp;&nbsp;</span>Function Overloading:</a></span></li></ul></li><li><span><a href=\"#Creation-of-class\" data-toc-modified-id=\"Creation-of-class-1.2\"><span class=\"toc-item-num\">1.2&nbsp;&nbsp;</span>Creation of class</a></span></li></ul></li></ul></div>"
11+
]
12+
},
13+
{
14+
"cell_type": "markdown",
15+
"metadata": {},
16+
"source": [
17+
"# Object Oriented Programming\n",
18+
"## Terminologies\n",
19+
"### Class:\n",
20+
"A __Class__ can be defined as a user-defined prototype for an object that defines a set of attributes that characterize any object of class. The __attributes__ are data members and methods, accessed via dot method.\n",
21+
"### Class Variables:\n",
22+
"A __Class Variable__ is the variable shared by all instances of the class. It is defined inside the class but outside any of the class's methods. It is not used as frequently as that of instance variable.\n",
23+
"### Instance Variables:\n",
24+
"A variable defined inside any methods of a class and belongs only to the current instance of the class.\n",
25+
"### Data Members:\n",
26+
"A __Data Member__ is a class variable or instance variable that holds data associated with a class and its objects.\n",
27+
"### Function Overloading:\n",
28+
"The assignment of more than one behavior to a particular function. The operation performed varies by the types of objects or arguments involved."
29+
]
30+
},
31+
{
32+
"cell_type": "markdown",
33+
"metadata": {},
34+
"source": [
35+
"## Creation of class\n",
36+
"__Syntax:__<br>\n",
37+
"<code>class Class_Name(object):\n",
38+
" 'Class_documentation(optional)'\n",
39+
" def \\__init\\__(self, param1, param2):\n",
40+
" initialization_of_some_data\n",
41+
" assignment_of_some_values\n",
42+
" def some_Method(self, param3, param4):\n",
43+
" do_something\n",
44+
" return some_data\n",
45+
" Other_Class_Suites</code>\n",
46+
"* The class_suite consists of all the component statements defining class members, data attributes and functions.\n",
47+
"* Class Documentation can be accessed via __Syntax:__<br>\n",
48+
" **Class_Name.\\__doc\\__**\n",
49+
" \n",
50+
"**Example:**<br>\n",
51+
"**Class Definition:**"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": 1,
57+
"metadata": {
58+
"ExecuteTime": {
59+
"end_time": "2018-06-11T19:41:25.054334Z",
60+
"start_time": "2018-06-11T19:41:25.043340Z"
61+
}
62+
},
63+
"outputs": [],
64+
"source": [
65+
"class Student(object):\n",
66+
" 'Student Detail Recorder'\n",
67+
" no_of_students = 0\n",
68+
" def __init__(self, name, reg_no, batch, program):\n",
69+
" self.name = name\n",
70+
" self.reg_no = reg_no\n",
71+
" self.batch = batch\n",
72+
" self.program = program\n",
73+
" Student.no_of_students += 1\n",
74+
" def total_student(self):\n",
75+
" return Student.no_of_students\n",
76+
" def fetch_student(self):\n",
77+
" return {'Name' : self.name, 'Reg.No' : self.reg_no, 'Batch' : self.batch, 'Program' : self.program}"
78+
]
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"metadata": {},
83+
"source": [
84+
"**Instance Object:**"
85+
]
86+
},
87+
{
88+
"cell_type": "code",
89+
"execution_count": 2,
90+
"metadata": {
91+
"ExecuteTime": {
92+
"end_time": "2018-06-11T19:41:29.122637Z",
93+
"start_time": "2018-06-11T19:41:29.110643Z"
94+
}
95+
},
96+
"outputs": [],
97+
"source": [
98+
"student1 = Student('Jonty Rhodes', 11502264, 2015, 'B.Tech | CSE')\n",
99+
"student2 = Student('The Roy', 11509584, 2015, 'M.Tech | ECE')"
100+
]
101+
},
102+
{
103+
"cell_type": "code",
104+
"execution_count": 4,
105+
"metadata": {
106+
"ExecuteTime": {
107+
"end_time": "2018-06-11T19:44:48.865495Z",
108+
"start_time": "2018-06-11T19:44:48.853502Z"
109+
}
110+
},
111+
"outputs": [
112+
{
113+
"name": "stdout",
114+
"output_type": "stream",
115+
"text": [
116+
"{'Name': 'Jonty Rhodes', 'Reg.No': 11502264, 'Batch': 2015, 'Program': 'B.Tech | CSE'}\n",
117+
"{'Name': 'The Roy', 'Reg.No': 11509584, 'Batch': 2015, 'Program': 'M.Tech | ECE'}\n",
118+
"Total Number of Students are: 2\n"
119+
]
120+
}
121+
],
122+
"source": [
123+
"print(student1.fetch_student())\n",
124+
"print(student2.fetch_student())\n",
125+
"print('Total Number of Students are: {}'.format(Student.no_of_students))"
126+
]
127+
},
128+
{
129+
"cell_type": "code",
130+
"execution_count": null,
131+
"metadata": {},
132+
"outputs": [],
133+
"source": []
134+
}
135+
],
136+
"metadata": {
137+
"kernelspec": {
138+
"display_name": "Python 3",
139+
"language": "python",
140+
"name": "python3"
141+
},
142+
"language_info": {
143+
"codemirror_mode": {
144+
"name": "ipython",
145+
"version": 3
146+
},
147+
"file_extension": ".py",
148+
"mimetype": "text/x-python",
149+
"name": "python",
150+
"nbconvert_exporter": "python",
151+
"pygments_lexer": "ipython3",
152+
"version": "3.6.5"
153+
},
154+
"latex_envs": {
155+
"LaTeX_envs_menu_present": true,
156+
"autoclose": false,
157+
"autocomplete": true,
158+
"bibliofile": "biblio.bib",
159+
"cite_by": "apalike",
160+
"current_citInitial": 1,
161+
"eqLabelWithNumbers": true,
162+
"eqNumInitial": 1,
163+
"hotkeys": {
164+
"equation": "Ctrl-E",
165+
"itemize": "Ctrl-I"
166+
},
167+
"labels_anchors": false,
168+
"latex_user_defs": false,
169+
"report_style_numbering": false,
170+
"user_envs_cfg": false
171+
},
172+
"toc": {
173+
"base_numbering": 1,
174+
"nav_menu": {},
175+
"number_sections": true,
176+
"sideBar": true,
177+
"skip_h1_title": false,
178+
"title_cell": "Table of Contents",
179+
"title_sidebar": "Contents",
180+
"toc_cell": true,
181+
"toc_position": {},
182+
"toc_section_display": true,
183+
"toc_window_display": true
184+
}
185+
},
186+
"nbformat": 4,
187+
"nbformat_minor": 2
188+
}

0 commit comments

Comments
 (0)