Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Abstract-type/Python/abstract-type-1.py
Normal file
13
Task/Abstract-type/Python/abstract-type-1.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class BaseQueue(object):
|
||||
"""Abstract/Virtual Class
|
||||
"""
|
||||
def __init__(self):
|
||||
self.contents = list()
|
||||
raise NotImplementedError
|
||||
def Enqueue(self, item):
|
||||
raise NotImplementedError
|
||||
def Dequeue(self):
|
||||
raise NotImplementedError
|
||||
def Print_Contents(self):
|
||||
for i in self.contents:
|
||||
print i,
|
||||
21
Task/Abstract-type/Python/abstract-type-2.py
Normal file
21
Task/Abstract-type/Python/abstract-type-2.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
class BaseQueue():
|
||||
"""Abstract Class
|
||||
"""
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
def __init__(self):
|
||||
self.contents = list()
|
||||
|
||||
@abstractmethod
|
||||
def Enqueue(self, item):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def Dequeue(self):
|
||||
pass
|
||||
|
||||
def Print_Contents(self):
|
||||
for i in self.contents:
|
||||
print i,
|
||||
Loading…
Add table
Add a link
Reference in a new issue