FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-reference/python/oop.py at main · melchisedech333/code-reference · GitHub
melchisedech333
/
code-reference
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
code-reference
/
python
/
oop.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (17 loc) · 485 Bytes
Breadcrumbs
code-reference
/
python
/
oop.py
Copy path
File metadata and controls
27 lines (17 loc) · 485 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# -*- coding: utf-8 -*-
class
Animal
:
# Constructor
def
__init__
(
self
,
p1
,
p2
):
self
.
param1
=
p1
self
.
param2
=
p2
animal
=
Animal
(
"str1"
,
10
)
print
(
"Values: {}, {}"
.
format
(
animal
.
param1
,
animal
.
param2
))
# Herança.
class
Dog
(
Animal
):
def
__init__
(
self
,
p1
,
p2
):
Animal
.
__init__
(
self
,
p1
,
p2
)
def
print_values
(
self
):
print
(
"Dog: {}, {}"
.
format
(
self
.
param1
,
self
.
param2
))
dog
=
Dog
(
"a"
,
"b"
)
dog
.
print_values
()
Back
|
FazBrowse Home
|
New Git URL