Accessing a public method using scope variable
Posted: Sun Aug 08, 2010 5:58 am
Hi there,
I'm trying to learn OOP-PHP, and I have found something that surprises me. I have the following code:
How is it possible that the double colon let me go inside the method of that independent class (not base class) without any problems? Isn't the double colon just used for static and constants?
Thanks
I'm trying to learn OOP-PHP, and I have found something that surprises me. I have the following code:
Code: Select all
<?php
class CalledClass
{
function go2()
{
echo "hello world";
}
}
class CallerClass
{
function go()
{
CalledClass::go2();
}
}
$obj = new CallerClass();
$obj->go();Thanks