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! While you're at it, check out some resources Treehouse students have shared here.
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 trialAlfredo Prince
6,175 PointsI don't understand how this is wrong. $bass = new Fish("Largemouth bass", "Excellent", "22 pounds 5 ounces");
I am supposed to create a fish object named $bass withthe above features. and it tells me that task 1 will not pass
<?php
class Fish {
public $common_name, $flavor, $record_weight;
function __construct($name, $flavor, $record){
$this-> common_name = $name;
$this-> flavor = $flavor;
$this-> record_weight = $record;
}
$bass = new Fish("Largemouth bass", "Excellent", "22 pounds 5 ounces");
}
?>
3 Answers
Alfredo Prince
6,175 PointsYes I tried that but it gave me this error: Did you set the common name for the bass to "Largemouth Bass"? Pass this as the first parameter of the Fish object.
Alexander Davison
65,469 PointsI will show you the answer to that in my other answer. (I will update it.)
Alfredo Prince
6,175 PointsDid you already change it? It looks the same.
Thanks for the help.
Alexander Davison
65,469 Points"bass" into "Bass". Told ya the challenges are picky.
Alfredo Prince
6,175 PointsYea I just saw your comment.
Thank you for your help!
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsYou are doing great! However, the $bass stuff needs to go outside the Fish class. Try this:
Hope that helps!
I saw you mentioned that it gave you an error "Did you set the common name for the bass to "Largemouth Bass"?" The answer to that is that the Treehouse code challenges are very picky, so you must do "Largemouth Bass" instead of "Largemouth bass".
Complete code: