Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

overloading and overriding in php

<?php

class Foo {
   function myFoo() {
      return "Foo";
   }
}

class Bar extends Foo {
   function myFoo() {
      return "Bar";
   }
}

$foo = new Foo;
$bar = new Bar;
echo($foo->myFoo()); //"Foo"
echo($bar->myFoo()); //"Bar"
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #overloading #overriding #php
ADD COMMENT
Topic
Name
7+7 =