04.
Calling Parent Class Methods
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
15 Comments
Hi, this challenge is not working correctly. It is showing "Fatal error: Uncaught Error: Call to undefined method DeathStar::getLaserRange() in DeathStarII.php on line 7" error.
Same. But it’s possible to cheat a bit: just
return 2000000 * 2, and challenge would pass =)Yeah, not as expected, but correct answer didn't work.
Hey Yaroslavche,
Could you show me the code you're running that's throwing an error? I just tried the correct answer in my browser, and it worked fine
Hi, MolloKhan,
It would sound very strange, but now it works! =)
As I can remember, firstly, I've added to
DeathStarIIclass next code:And it contained exactly the same error, as in Serhii's comment:
Call to undefined method DeathStar::getLaserRange() in DeathStarII.php on line 7From error message you can notice, that I've tried call parent method
getLaserRangeinDeathStarII.Then I've tried as in video example (defined a variable, set from parent call, multiplied by two and return that variable) - same error. Then I've tried just return 2 * 2000000, and it was worked fine, challenge passed (but shouldn't, I suppose. since that's cheating =) ). Then I've checked correct answer, slightly surprised that was the same, that I've tried first time, copy correct answer and got the same error.
IDK why that happened and can't reproduce again =)
Woh, that's weird. My apologies for the inconveniences but at least it's now working :)
Cheers!
I'm running into an error with this exercise. AbstractDeathStar isn't part of this exercise and its not in the visible code, so I don't know where its getting this from.
Hey Terrence,
Are you talking about a challenge in this chapter? What challenge number exactly? Or you can just link to it.
But if the problem with a challenge - please, try to wait about 15 minutes when the challenge is shut down and then reload the page - it will recreate a new challenge instance. This time it should work I think. Sometimes challenges may not work correctly and do not save your code back to the server. Let us know if the issue still relevant to you.
Cheers!
Thanks. I'm on another computer this morning and its working fine.
Hey Terrence,
Awesome, thanks for confirming it worked for you :)
Cheers!
A friendly warning to anyone attempting to run this code inside a virtual machine, I never got the error "maximum function nesting level of '200' reached, aborting!", instead my entire virtual machine was locking up and crashing, and in my windows host it was showing disk usage spiking at 100%.
If anyone else is getting a locked up vm that crashes, this is the issue. I'm not sure if this is a bug in virtual box, ubuntu my guest, windows my host, or what but I do know is running this code completely locks up my ubuntu guest vm!
Hey Galen S.!
Oh no! Sorry about that! And it even affected your Windows host, lame!
There may be one explanation: check if XDebug is installed on your VM. That's a great tool that often can avoid this type of stuff. In fact, I believe it is THE reason that mine hit the error, instead of spinning forever.
Cheers!
"Houston: no signs of life"
Start the conversation!