[Tutor] Class Inheritance

2017-02-21 Thread Rafael Knuth
Hey there, I am trying to wrap my head around Class Inheritance in Python, and I wrote a little program which is supposed to calculate revenues from customers who don't get a discount (parent class) and those who get a 30% discount (child class): class FullPriceCustomer(object): def __init__(

Re: [Tutor] Class Inheritance

2017-02-21 Thread Alan Gauld via Tutor
On 21/02/17 09:49, Rafael Knuth wrote: > class FullPriceCustomer(object): > def __init__(self, customer, rate, hours): > > > class DiscountCustomer(FullPriceCustomer): > discount = 0.7 > def calculate_discount(self, rate, hours): > > customer_one = DiscountCustomer("Customer A", 75,

Re: [Tutor] Class Inheritance

2017-02-21 Thread Alan Gauld via Tutor
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

Re: [Tutor] Class Inheritance

2017-02-21 Thread Peter Otten
Rafael Knuth wrote: > Hey there, > > I am trying to wrap my head around Class Inheritance in Python, and I > wrote a little program which is supposed to calculate revenues from > customers who don't get a discount (parent class) and those who get a > 30% discount (child class): > > class FullPri