mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Initial commit of Python queries and QL libraries.
This commit is contained in:
committed by
Mark Shannon
parent
90c75cd362
commit
5f58824d1b
17
python/ql/src/Classes/SubclassShadowing.py
Normal file
17
python/ql/src/Classes/SubclassShadowing.py
Normal file
@@ -0,0 +1,17 @@
|
||||
class Mammal(object):
|
||||
|
||||
def __init__(self, milk = 0):
|
||||
self.milk = milk
|
||||
|
||||
|
||||
class Cow(Mammal):
|
||||
|
||||
def __init__(self):
|
||||
Mammal.__init__(self)
|
||||
|
||||
def milk(self):
|
||||
return "Milk"
|
||||
|
||||
#Cow().milk() will raise an error as Cow().milk is the 'milk' attribute
|
||||
#set in Mammal.__init__, not the 'milk' method defined on Cow.
|
||||
|
||||
Reference in New Issue
Block a user