Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Konrad Pilch
Konrad Pilch
2,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?

1 Answer

Nathaniel Kolenberg
Nathaniel Kolenberg
12,836 Points

Hi Konrad,

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.