fork(2) download
  1. <?php
  2.  
  3. class Graph
  4. {
  5. public function Draw($name) {
  6. echo $name;
  7. }
  8. }
  9.  
  10. class NewGraph extends Graph
  11. {
  12. private $_graphData=[];
  13. public function getName()
  14. {
  15. return $this->_graphData['Name'];
  16. }
  17. public function setName($newName)
  18. {
  19. $this->_graphData['Name']=$newName;
  20. }
  21. public function draw()
  22. {
  23. parent::Draw($this->_graphData['Name']);
  24.  
  25. }
  26. }
  27.  
  28. $ng = new NewGraph();
  29. $ng->setName('TBT');
  30. echo $ng->getName() . '\r\n';
  31. $ng->draw();
Success #stdin #stdout #stderr 0.02s 23604KB
stdin
Standard input is empty
stdout
TBT\r\nTBT
stderr
PHP Warning:  Declaration of NewGraph::draw() should be compatible with Graph::Draw($name) in /home/Bb6kLu/prog.php on line 26