Page 1 of 1

Basic Class Question

Posted: Sat Dec 18, 2010 6:56 am
by Aristona
Hi,
A very basic question as I said.

What's the difference between "Class::Page()" and "$class->Page()" ?
Also what kind of benefits do I get by using $this? (Computer related benefits like performance.)

It will be good if you can explain these detailed.

Thanks.

Re: Basic Class Question

Posted: Sat Dec 18, 2010 11:47 am
by Darhazer
Class::Page() is a call to a static method. Static methods are methods of a class and not of it's instance, and generally they have no state (or at least should not).

$this->Page() is a call to a method of the instance. It makes a lot of difference if you have polymorphism as it call the method of the current instance, which can be any subclass of Class.

I suggest you to google and read about static methods, hiding/minimizing state and polymorphism