import abc
class Agenda(metaclass=abc.ABCMeta):
def __init__(self):
self.__items = []
@abc.abstractclassmethod
def addItem(self,item):
pass
@abc.abstractclassmethod
def getItem (self):
pass
def isEmpty(self):
return self.__items == []
def clear(self):
self.__items = []
class StackAgenda(Agenda):
def __init__(self):
super().__init__()
def addItem(self,item):
self.__items.append(item)
def getItem(self):
return self.__items.pop()
When i try to use any of the StackAgenda methods it tells me that StackAgenda object doesn't have the self.__items attribute. I really don't understand why this is happening, i probably made a dumb error that i cannot find. Thanks in advance!
__foonames are a misfeature, and lead to your problem. Never use them.