I need to have the sub classes take the information from the superclass Vehicle and go into their appropriate classes and carry the information. However I cant get them to carry over into the newer classes. What do I need to do to allow inheritance of specific traits?
class Vehicle:
def __init__(self, make , model):
self.year = 2000
self.make = make
self.model = model
# a vehicle is instantiated with a make and model
@property
def year(self):
return self._year
print "year"
#mutator
@year.setter
def year(self, value):
if (value >= 2000):
self._year = value
if (value <= 2018):
self._year = value
if (value > 2018):
self.value = 2018
else:
self._year = 2000
pass
class Truck(Vehicle):
pass
class Car(Vehicle):
pass
class DodgeRam(Truck):
pass
class HondaCivic(Car):
pass
ram = DodgeRam(2016)
print ram
civic1 = HondaCivic(2007)
print civic1
civic2 = HondaCivic(1999)
print civic2