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 trialCaio Ferrari
5,455 PointsIs "__construct" a default value?
In my notes and codes, I noticed that using the __construct is mandatory to call the arguments. So, if I want to use any other name for this function (like myValues for example) it will not work!
Am I right?
THX!
1 Answer
Chris Shaw
26,676 PointsHi Caio,
The __construct
method is the only access point for arguments when creating a new instance of a class, if you need other functionality to be executed upon creating a new class instance - you can call your additional methods from within the constructor.
Hope that helps.