justinc (16) [Avatar] Offline
#1
Hello

I'm enjoying the book so far but I was having trouble with lesson 11-4 "Implementing multiple interfaces"
the issue seems to be with the Vehicle class and the non VehicleInterface methods (so the Vehicle class methods) like setMake, setModel, setYear

lines 40-52 in the book sample 11.4, page 133-134

if I create v1 as a VehicleInterface, then only the VehicleInterface methods are available but the code calls the class methods.
if I change v1 to be a vehicle class it works

so
Vehicle v1 = new Vehicle();

instead of
VehicleInterface v1 = new Vehicle();

I copied the code from the github repo just to make sure I didn't have a typo and this change was the only way I could get it to work

thanks
424165 (1) [Avatar] Offline
#2
Thanks for letting me know about this error in my book. You are correct, the object v1 should have been defined as a Vehicle class object and not VehicleInterface. I will submit a correction. I'm glad that you are enjoying the book and I really appreciate your feedback.