Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a03896a

Browse files
authored
Create Reference_variable.py
1 parent 954d011 commit a03896a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎docs/OOPS/Reference_variable.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'''
2+
An object is like a balloon and the reference variable is like the ribbon connecting it to the ground.
3+
'''
4+
5+
class Mobile:
6+
def __init__(self, price, brand):
7+
self.price = price
8+
self.brand = brand
9+
10+
mob1=Mobile(1000, "Apple")
11+
print(mob1.price)
12+
#We are able to access the object
13+
#in subsequent lines because we
14+
#have a reference variable. This is
15+
#like holding a balloon with a ribbon

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /