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 trial
Konrad Pilch2,435 Points
WHen do we exactly use :: ?
When exactly do we use
So for example
When exactly we need to use the :: ? and not for example $this-> or other sutff?
Nathaniel Kolenberg12,836 Points
I asked the question as well to a developer at some point and they explained to me that sometimes you have functions defined as private in your Parent class, that you don't want to pass on to the instantiated Child objects. In that case, if you still want to use the private function, you would use Parent::function().
But in all honesty, I've not yet used this kind of method myself apart from using PDO functions such as PDO::PARAM_STR.