php - How do I echo out multiple overridden methods of an extended class? -
For this example assume that I have a file named I have another 'example1.php' File, which is like this: I have another file named 'example2.php': Finally, if I want to output anything that overrides that method and something like this: How can I go about doing this? Echo to return your class and then try this way: base.php , this By way:
class baseClass {function testMethod ()} {// some default stuff}}
class example1 increases the base class (function testMethod) {echo 'hello world!'; }}
class example2 baseClass {function testMethod () {echo 'bye world!'; }}
& lt; Div & gt; & Lt; P & gt; Hello World! & Lt; / P & gt; & Lt; P & gt; goodbye World! & Lt; / P & gt; & Lt; / Div & gt;
$ c1 = new example1 (); $ C2 = new example 2 (); $ Text1 = c1-> testMethod (); $ Text2 = c2-> testMethod (); Echo & lt; & Lt; & Lt; EOD & lt; Div & gt; & Lt; P & gt; {$ Text1} & lt; / P & gt; & Lt; P & gt; {$ Text2} & lt; / P & gt; & Lt; / Div & gt; The end of the day;
Comments
Post a Comment