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 trialammarkhan
Front End Web Development Techdegree Student 21,661 PointsWhy do we pass object in static class as a args.
I was watching the video, in which Alena wrote a static property of Render::display($recipe1)
, for previous videos the $recipe1
is a object itself, so how does that work?
Frans Teja
8,175 PointsFrans Teja
8,175 PointsHi, Ammar Khan
Yes it can work both ways, but instead this video Alena moved the one of the function into a new Class that is called "Render". From that She's setting it up as static function which we should call it in our php.
Render::display($recipe1)
Explanation, "Render", this is the name of the class "display()", this is the name of the function inside Render Class "$recipe1", this is the name of the New stated Object that has been done in earlier videos.
As for that When she called that static function from Render Class. It works the same as like the video before, but instead we should use $recipe1 instead of $this because they are already in different class.