Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Is there really a need for the second constructor?
Hampton said that "there's no way of setting the flavor without completely reimplementing our constructor in the Soda class". But couldn't it be done by just setting a value for the $flavor property in Soda, like this:
public $flavor = "Grape";
If we just do this, when we do
"Product Name: Space Juice Soda Flavor: Grape"
just like Hampton does with the extended constructor in the Soda class.
Of course this way the Grape value would be hard-wired to the $flavor property, and you couldn't change the flavors when creating new Soda objects (I'm aware of that).
I'm just saying that, for the purposes here (just getting the getInfo() function working with the new information in the Soda class), you could very well dispense with the extra constructor.