Quick question on abstract methods
Moderator: General Moderators
- VirtuosiMedia
- Forum Contributor
- Posts: 133
- Joined: Thu Jun 12, 2008 6:16 pm
Quick question on abstract methods
Can the child classes change, add, or subtract parameters for abstract methods or must all parameters be defined in the abstract method? I didn't see a quick answer about parameter rules for abstract methods in any of the articles I looked at or in the PHP documentation.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Quick question on abstract methods
The best answer is to just try it and find out.
If you must read about it officially then Google PHP method overriding *not* overloading -- the latter of which I am pretty sure PHP doesn't support.
If you must read about it officially then Google PHP method overriding *not* overloading -- the latter of which I am pretty sure PHP doesn't support.
-
WebbieDave
- Forum Contributor
- Posts: 213
- Joined: Sun Jul 15, 2007 7:07 am
Re: Quick question on abstract methods
No, the signatures must match.VirtuosiMedia wrote:Can the child classes change, add, or subtract parameters for abstract methods
Though they don't possess the ease of use as compared to other OOP languages, there are definitely means within PHP to facilitate method/property overloading.Hockey wrote:If you must read about it officially then Google PHP method overriding *not* overloading -- the latter of which I am pretty sure PHP doesn't support.
http://us.php.net/manual/en/overload.examples.php
- VirtuosiMedia
- Forum Contributor
- Posts: 133
- Joined: Thu Jun 12, 2008 6:16 pm
Re: Quick question on abstract methods
Thanks.WebbieDave wrote: No, the signatures must match.