class Product(object):
""" Model a product to sell
This is a super class, whose interface is visible to a factory. An
object of Its sub- class will be returned when the factory is asked
by a client based on the input key identifying the returned product
"""
@classmethod
def name(cls):
if cls.oSo == None:
cls.oSo = cls()
#
return cls.oSo.get_type()
#=============================================
def __init__(self, price):
self._price = price
def get_type(self):
return self.__class__.__name__
def __str__(self):
return self.get_type()+" "+str(self.price)
#=============================================
def _get_price(self):
raise NotImplementedError
def _set_price(self, price):
raise NotImplementedError
price = property(fget=lambda self: self._get_price(),
fset=lambda self, price: self._set_price(price))
#cls