Scope Resolution:: and self/parent

parent:: - refers to the class that a child class is extended from (which could save problems if the main class name changes - the functions won't have to change).

The documentation syntax often shows Classname::MethodName - which is just a succint means of showing method/class relationship. This does not mean it's the preferred means to access methods (versus): ->methodName().

Static functions retain the value computed by the last call of the function

11
11
11

generic pet is sleeping

Butch the dog is sleeping

Peppy the cat is sleeping


eat method

Butch the dog is eating

Peppy the cat is eating

generic pet is eating


sleep method

Butch the dog is sleeping

Peppy the cat is sleeping

generic pet is sleeping


play method

Butch the dog is playing in the Pet Class.

Butch the dog is play override fetching

Peppy the cat is playing in the Pet Class.

Peppy the cat is overriding playing

generic pet is playing in the Pet Class.

Toggle Sidebar