php - How do I echo out multiple overridden methods of an extended class? -


For this example assume that I have a file named base.php , this By way:

  class baseClass {function testMethod ()} {// some default stuff}}   

I have another 'example1.php' File, which is like this:

  class example1 increases the base class (function testMethod) {echo 'hello world!'; }}   

I have another file named 'example2.php':

  class example2 baseClass {function testMethod () {echo 'bye world!'; }}   

Finally, if I want to output anything that overrides that method and something like this:

  & lt; Div & gt; & Lt; P & gt; Hello World! & Lt; / P & gt; & Lt; P & gt; goodbye World! & Lt; / P & gt; & Lt; / Div & gt;   

How can I go about doing this?

Echo to return your class and then try this way:

  $ 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

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -