[nycphp-talk] For Dan - per request
Analysis & Solutions
danielc at analysisandsolutions.com
Mon Oct 6 14:37:33 EDT 2003
Hi Phil:
On Mon, Oct 06, 2003 at 02:17:49PM -0400, soazine at pop.erols.com wrote:
>
> http://us2.php.net/manual/en/ref.classobj.php
Okay. Here's part of the problem. You're looking at PHP's functions that
manipulate classes. You need to be looking at the "language reference"
section that explains how to write your own objects and utilize them.
Manual:
http://us2.php.net/manual/en/index.php
Section II: Language Reference
Subsection 13: Classes and Objects
http://us2.php.net/manual/en/language.oop.php
Read the text there then copy the example.
Then, since you're interested in extensions of classes, click the link on
the top of the chapter named "extends."
Read that information. Copy the examples into the same file as the other
example. In there is this line, that answers your question of how to
access a method from the original class:
$ncart->add_item("10", 1); // (inherited functionality from cart)
That's how you call ANYTHING from any part of the class when you're in PHP
code that's not part of a class.
Execute the example to see what it does.
> http://groups.google.com/groups?hl=en&lr=&ie=ISO-8859-1&q=class+extends&btnG
> =Google+Search&meta=group%3Dcomp.lang.php
>
> Couldn't find anything there other than the typical denotation
> $this->super_class_method()
Which is how you call a method of the the class (be it a parent, child or
itself) from _inside_ any method of the class regardless of whether you're
in the parent, child or present class.
> There you have it. As you can see I followed the steps to the letter in
> searching out the problem on my own, which was to no avail at the time,
> hence, my decision to brainlessly post on nyphp.org my apparently inane
> questions about classes and calling the superclass method from the subclass.
If you posted these URI's up front, we could have told you up front that
you were looking in the wrong places and point you to the right place.
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
More information about the talk
mailing list