Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2169

Re: An overloading question

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: An overloading question
Date 2011-06-14 22:08 -0400
Organization A noiseless patient Spider
Message-ID <it946e$gij$1@dont-email.me> (permalink)
References (2 earlier) <it8n87$7rj$1@dont-email.me> <it8ps7$su3$1@dont-email.me> <it8rmh$6is$1@dont-email.me> <it8vca$nt9$2@dont-email.me> <it93k1$dkn$1@dont-email.me>

Show all headers | View raw


On 6/14/2011 9:58 PM, sheldonlg wrote:
> On 6/14/2011 8:45 PM, Jerry Stuckle wrote:
>> Id you created it properly, then the constructor in B should be calling
>> b::y().
>>
>> I still suggest you have a mistake in your code.
>
> No, both constructors are there but are empty.
>
> Now here is the really weird thing. I decided to experiment with a
> simplified example and so copied the entire files into a test area via a
> copy/paste. I then eliminated all methods that were not called,
> eliminated all includes that were no longer needed in the classes, and
> modified the important routines to only do the printing and the one
> calling routine in the class to only call the prescribed method and not
> do any other work. So, besides the constructors (which were empty) the
> base class had two methods and the overload class had one (with the name
> as the final method invoked in the base class). The only typing I did
> was putting print statements in the final invoked methods to identify
> which one was doing the output.
>
> I expected the same result as the I had been getting. However, what
> happened was that the output was from the overloaded method, not the
> base method.
>
> Now I am totally baffled.
>

Which indicates there is some problem with your original code.  It could 
be anything - including misplaced /*...*/ comments, for instance.

But I looked again at your code, and I'm confused,  In class A you have

public function b().

And in class B you have

public function a().

Which is it?

Also, you are aware, aren't you, that this follows the old style PHP 
constructors (which are still valid) where the constructor's name is the 
name of the class (instead of __construct() ).

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

An overloading question sheldonlg <sheldonlg@thevillages.net> - 2011-06-14 12:49 -0400
  Re: An overloading question Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-06-14 18:32 +0000
    Re: An overloading question sheldonlg <sheldonlg@thevillages.net> - 2011-06-14 18:27 -0400
      Re: An overloading question Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-14 19:12 -0400
        Re: An overloading question sheldonlg <sheldonlg@thevillages.net> - 2011-06-14 19:43 -0400
          Re: An overloading question Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-14 20:45 -0400
            Re: An overloading question sheldonlg <sheldonlg@thevillages.net> - 2011-06-14 21:58 -0400
              Re: An overloading question Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-14 22:08 -0400
              Re: An overloading question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-15 14:21 +0200
              Re: An overloading question sheldonlg <sheldonlg@thevillages.net> - 2011-06-15 12:55 -0400
        Re: An overloading question Michael Fesser <netizen@gmx.de> - 2011-06-15 18:04 +0200
          Re: An overloading question Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-15 12:53 -0400
      Re: An overloading question Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-06-15 03:41 +0000
      Re: An overloading question Michael Fesser <netizen@gmx.de> - 2011-06-15 18:02 +0200
  Re: An overloading question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-15 14:01 +0200

csiph-web