[Tutor] Class Inheritance
Alan Gauld
alan.gauld at yahoo.co.uk
Tue Feb 21 05:27:34 EST 2017
On 21/02/17 09:49, Rafael Knuth wrote:
> class DiscountCustomer(FullPriceCustomer):
> discount = 0.7
> def calculate_discount(self, rate, hours):
> print ("Your customer %s made you %s USD at a 30% discount
> rate this year." % (self.customer, self.rate * rate * discount))
I meant to add... are you sure that calculation is what you meant?
First point is that discount is not defined, you need to prefix
it with either self or DiscountCustomer.
But also, it doesn't use hours? Is that correct?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list