Re: An overloading question [message #174498 is a reply to message #174497] |
Wed, 15 June 2011 01:58 |
sheldonlg
Messages: 166 Registered: September 2010
Karma:
|
Senior Member |
|
|
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.
--
Shelly
|
|
|