View Single Post
Old 05-05-2008, 01:10 AM   #6 (permalink)
SOCK
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

Quote:
Originally Posted by Aaron View Post
Extension means that you inherit the properties and methods from a class, so that gives you access to the private methods, right?
Yes, extending a class means your child classes inherit all properties and methods. No, if they are declared private, then only the parent class has access to them. This is why I recommend to give them the protected visibility so derived classes can still have access to those properties. Note that even private properties are inherited, they're just not accessible.

Quote:
Originally Posted by Aaron View Post
Abstract... That sounds pointless to me. It allows for empty methods? Woopdie doo :/

Static? Meh, again, no use seen.
Actually, abstract classes are a very powerful way to implement what's known as polymorphism, or the ability to use different objects in the same way. This Wikipedia article on Object Oriented programming states that and more.

Think of abstract classes like this: you want to create an object that handles data storage. Period. The interface should be the same regardless of how the class stores data. So you can have an abstract class named 'DataHandler' with methods like 'putData' and 'getData', etc. You can derive this abstract class into a class that interacts with databases, or a class that stores and retrieves data from a flat file. These classes can be further derived into classes that specify what type of database, if the file is XML, JSON or regular text, etc. But the calling object will still use the same 'getData' and 'putData' methods, so it's totally flexible if you should want to switch how you store data.

Static method calls are essential in most OO programming; I use them everyday.

The bottom line; unless you plan on going all OO in your PHP code, or switch to Java or C#, all of this may not be relevant to you.
__________________
I reject your reality, and substitute my own.
SOCK is offline  
Reply With Quote
The Following User Says Thank You to SOCK For This Useful Post:
drewbee (05-05-2008)