Re: Classes question.
| From: | Matt McClanahan | Date: | Sat, 20 Jan 2001 06:21:50 +0000 |
| Subject: | Re: Classes question. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35781@lists.php.net to get a copy of this message | ||
On Fri, 19 Jan 2001, James McLaughlin wrote:
> I get an error when doing this....
>
> class Something
> {
> var $something;
>
> function Something($this->something)
> {
> More somethings
> }
>
> }
>
> The error tells me that I need a ")" in the line the function call is
> in. If I take the "$this->something" it will parse fine. Can you not
> do this?
No, you can't do this. Functions within the class can automatically get
to class variables with $this->something, so passing them as parameters
would be somewhat redundant.
class Something
{
var $something;
function Something()
{
$this->something = "More somethings";
}
}
Matt