For the php static method call question, could you please answer ;? Phpclass & nbsp; Cat & nbsp ;{} class & nbsp; Hypnotic_Cat & nbsp; extends & nbsp; Cat & nbsp ;{// & nbsp; Construc php static method call problems, please answer
class Cat {
}
class Hypnotic_Cat extends Cat {
// Constructor
function Hypnotic_Cat( ) {
}
// This function must be called statically
public static function hypnotize( ) {
echo ("The cat was hypnotized.");
//return;
}
}
// Hypnotize all cats
//Hypnotic_Cat::hypnotize( );
$hypnotic_cat = new Hypnotic_Cat( );
// Does nothing
$hypnotic_cat->hypnotize( );
?>
Why is it possible to use "->" to call or produce results? Static methods can only be called using?
------ Solution --------------------
Who told you they couldn't? Of course!
However, you must note that $ this cannot be used in static methods.
------ Solution --------------------
It can be used in this way, but it turns around. it is generally Hypnotic_Cat: hypnotize ();
------ Solution --------------------
Reference:
Who told you they couldn't? Of course!
However, you must note that $ this cannot be used in static methods.
In the static method, you 'd better not appear-> that's right.
The call method is flexible.